BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Indy 8: HTTP server - Can it be used with PHP?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Jamie Dale
Guest





PostPosted: Tue Sep 26, 2006 2:19 am    Post subject: Indy 8: HTTP server - Can it be used with PHP? Reply with quote



Hi

I'm looking at using a IdHTTP server in my project to give it a web based
control interface aswell as a TCP connection (for a TCP client interface).

I was wondering if IdHTTP can work in conjunction with PHP, or if there is a
way to get the IdHTTP server to understand the input from a form and create
an output accordingly?

Anyone had any experience with this?

I don't want to rely on dependencies (EG, SQL servers) so a basic built-in
HTTP server which can understand certain GET parameters etc would be really
great. (Incase your wondering, all info is stored in a .ini file so that it
can be moved from one machine to another with no installations needed).

Any ideas?

Jamie
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Sep 26, 2006 3:31 am    Post subject: Re: Indy 8: HTTP server - Can it be used with PHP? Reply with quote



"Jamie Dale" <j.dale (AT) turboz (DOT) net> wrote in message
news:451847f7 (AT) newsgroups (DOT) borland.com...

Quote:
I'm looking at using a IdHTTP server in my project to give it
a web based control interface aswell as a TCP connection
(for a TCP client interface).

Indy 8 is a very old version that is no longer supported. You should
upgrade to the latest Indy 9 or 10 snapshot version.

Quote:
I was wondering if IdHTTP can work in conjunction with PHP

PHP is an external application that your server code would have to execute.
Indy (and HTTP in general) has no concept of PHP. Your server would forward
the client's submitted data to the PHP executable, and then forward the PHP
output back to the client.

Quote:
or if there is a way to get the IdHTTP server to understand the
input from a form and create an output accordingly?

I cannot speak for Indy 8, but in Indy 9/10, the submitted form values are
provided to your server code in a readibly avalable manner that your code
can use directly, and then send data back to the client.

Quote:
I don't want to rely on dependencies (EG, SQL servers) so a basic
built-in HTTP server which can understand certain GET parameters etc
would be really great.

Then you would not be able to use PHP, as that is a separate executable that
would have to be installed on the server machine alongside your own
application.


Gambit
Back to top
Jamie Dale
Guest





PostPosted: Tue Sep 26, 2006 3:43 pm    Post subject: Re: Indy 8: HTTP server - Can it be used with PHP? Reply with quote



"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:4518596e$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Jamie Dale" <j.dale (AT) turboz (DOT) net> wrote in message
news:451847f7 (AT) newsgroups (DOT) borland.com...

I'm looking at using a IdHTTP server in my project to give it
a web based control interface aswell as a TCP connection
(for a TCP client interface).

Indy 8 is a very old version that is no longer supported. You should
upgrade to the latest Indy 9 or 10 snapshot version.

Yes I know lol. Trouble is after the greif I had with Delphi 2005/Indy
10/ASP.NET it kind of put me right off.

That and I've also seen numerous bugs being reported on these newsgroups for
the latest versions - I feel quite lucky with V8 because it actually works
and doesn't seem to be buggy. I may be wrong but heck it does the job for
me!

Quote:
I was wondering if IdHTTP can work in conjunction with PHP

PHP is an external application that your server code would have to
execute.
Indy (and HTTP in general) has no concept of PHP. Your server would
forward
the client's submitted data to the PHP executable, and then forward the
PHP
output back to the client.

Yes I realise that, but what I was asking is, is there a way to make the
IdHTTP server recognise what it should pass to PHP? - How can it be done?
etc. Basically I was kind of looking for any sample code which would give me
the first step on the ladder.

Quote:
or if there is a way to get the IdHTTP server to understand the
input from a form and create an output accordingly?

I cannot speak for Indy 8, but in Indy 9/10, the submitted form values are
provided to your server code in a readibly avalable manner that your code
can use directly, and then send data back to the client.

Cool. I'll have a tinker with the Indy 8 docs and see what else I can locate
(if anything).

Quote:
I don't want to rely on dependencies (EG, SQL servers) so a basic
built-in HTTP server which can understand certain GET parameters etc
would be really great.

Then you would not be able to use PHP, as that is a separate executable
that
would have to be installed on the server machine alongside your own
application.

Well in ordinary circumstances, however I currently have a WAMP setup
(Windows Apache, MySQL, PHP) and it can be moved to any PC without
installation, run of USB drive etc. IT shouldn't be too hard to get PHP
working as it isn't even a service - it's simply called when needed. I
reckon using PHP is possible as long as I can somehow get IdHTTP to do it's
part!

Any more ideas Remy??
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Sep 26, 2006 10:19 pm    Post subject: Re: Indy 8: HTTP server - Can it be used with PHP? Reply with quote

"Jamie Dale" <j.dale (AT) turboz (DOT) net> wrote in message
news:4519043e (AT) newsgroups (DOT) borland.com...

Quote:
Yes I realise that, but what I was asking is, is there a way to
make the IdHTTP server recognise what it should pass to PHP?

Like I said, I cannot speak for Indy 8, but in Indy 9/10, yes. The posted
values are provided to your server code. Or, what you generally would do
instead is recognize that the request is trying to execute a PHP script, so
you would then forward the raw posted data as-is to the PHP executable
instead. When you run the PHP executable, you would have to redirect its
STDIN, STDOUT, and STDERR pipes. CreateProcess() and CreatePipe() can help
you with that, and there are lenty on examples online to demonstrate that.
You would then write the posted data to the PHP's STDIN pipe, and then pass
back to the client any data that you read from the STDOUT and STDERR pipes.


Gambit
Back to top
Jamie Dale
Guest





PostPosted: Tue Sep 26, 2006 10:42 pm    Post subject: Re: Indy 8: HTTP server - Can it be used with PHP? Reply with quote

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:451962b7$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Jamie Dale" <j.dale (AT) turboz (DOT) net> wrote in message
news:4519043e (AT) newsgroups (DOT) borland.com...

Yes I realise that, but what I was asking is, is there a way to
make the IdHTTP server recognise what it should pass to PHP?

Like I said, I cannot speak for Indy 8, but in Indy 9/10, yes. The posted
values are provided to your server code.

Yep, found that in Indy 8 - Accessed as: RequestInfo.Params
EG
For I := 0 to RequestInfo.Params.Count -1 do
begin
lbLog.Items.Add(RequestInfo.Params.Strings[I]); //lbLog is a
TListBox
end;

I don't know how you access them in 9/10 but thats how I found it could be
done in V8 (acessing each parameter one by one).

Quote:
Or, what you generally would do
instead is recognize that the request is trying to execute a PHP script,
so
you would then forward the raw posted data as-is to the PHP executable
instead. When you run the PHP executable, you would have to redirect its
STDIN, STDOUT, and STDERR pipes. CreateProcess() and CreatePipe() can
help
you with that, and there are lenty on examples online to demonstrate that.
You would then write the posted data to the PHP's STDIN pipe, and then
pass
back to the client any data that you read from the STDOUT and STDERR
pipes.

Ah! - That sounds like the info I needed! - Thanks Remy I'll google these
ideas now and see what I can do!

Thanks pal!

J
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Sep 27, 2006 2:27 am    Post subject: Re: Indy 8: HTTP server - Can it be used with PHP? Reply with quote

"Jamie Dale" <j.dale (AT) turboz (DOT) net> wrote in message
news:45196680 (AT) newsgroups (DOT) borland.com...

Quote:
I don't know how you access them in 9/10 but thats how I found
it could be done in V8 (acessing each parameter one by one).

It is the same in Indy 9 and 10.


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.