How to write "http connection" in php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danielson
Forum Newbie
Posts: 5
Joined: Wed Oct 16, 2002 9:20 am

How to write "http connection" in php?

Post by danielson »

In coldfusion, there is a tag called "CFHTTP", it means to retrieve files from web servers, and display them in the user's browser.
There is another tag "CFHTTPPARAM", it means to define data to be sent to the server including cookies, form data, and CGI, URL, file variables
If I use http connection in php to simulate POST...
I can use fsockopen()..is it right?
how can I transfer the parameters??
I must transfer the parameters to the file such that I can do search in the database and get the result.
Thanks a lot!!
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Do you mean posting using POST if not you could use

Code: Select all

<?php
header("Location:  index.php?string=balhblah");
?>
User avatar
Phirus
Forum Commoner
Posts: 37
Joined: Thu Apr 18, 2002 4:10 pm
Contact:

Post by Phirus »

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

danielson
Forum Newbie
Posts: 5
Joined: Wed Oct 16, 2002 9:20 am

Post by danielson »

Thanks for your answer...
Now I am making a page(A.php) for searching books..
My problem is that my page(A.php) has to connect to a ".dll file"
and the ".dll file" has the search result and my page(A.php) has to grab the result to show them on my page..
I don't know how to transfer the parameters...
ex:I type the author's name in the form(B.php), and the from does action to my page (A.php); (A.php) shows the result..
But I have to transfer the author's name which is typed in (B.php). (A.php) will help transfer the author's name from (B.php) to ".dll file" so that the search can be done according to the author's name.
I hope you can understand my meaning..
My key problem is how I can transfer the author's name??
How to write in (A.php)??
I appreciate your help. Thanks a lot!! :D
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

the .dll is a ISAPI-module for a webserver and (seen from outside) behaves like a normal webpage?
danielson
Forum Newbie
Posts: 5
Joined: Wed Oct 16, 2002 9:20 am

Post by danielson »

I don't know the .dll file's type...
But the .dll contains the query result of database.
My page has to arrange the result and show them.
:?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

that's important to know. It will determine how to access the data.
danielson
Forum Newbie
Posts: 5
Joined: Wed Oct 16, 2002 9:20 am

Post by danielson »

Thanks for your answer.
Do you mean that I must know the .dll file??
In coldfusion, I can use "cfhttp" to connect the file and "cfhttpparam" to transfer the parameters. I don't have to know the .dll file.
In php, can I use http in php or "fsockopen" to connect the file??
The importance is that I don't know how to transfer the parameters.
Someone told me that I have to know the header in http protocol.
How can I do in php??
Thanks!! 8O
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if you can connect that file via http then it seems to be a webserver plugin and you can do the same with php.
Unfortunately the url-wrapper for i.e. fopen do not support POST-method (only GET).
snoopy is supposed to handle that but I only know the URL not how it works.
danielson
Forum Newbie
Posts: 5
Joined: Wed Oct 16, 2002 9:20 am

Post by danielson »

Is snoopy a package for http in php??
And how can I install or use it?

P.S. My problem in coldfusion is written as follows..
<cfhttp url="http://www.kimo.com..." method="POST" resolveurl="yes">
<cfhttpparam type="FORMFIELD" name="Author" value="#author#">
<cfhttpparam type="FORMFIELD" name="keyword" value="#keyword#">
How can I turned it into php code?? :roll:
Post Reply