Posting in two forms (POST method) using PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

friend_al_23
New php-forum User
New php-forum User
Posts: 12
Joined: Sat Dec 28, 2002 6:30 pm
Location: Philippines
Contact:

Posting in two forms (POST method) using PHP

Postby friend_al_23 » Fri Sep 05, 2003 6:44 pm

For example, Yahoo! and Google. I would like to search the word "PHP tutorial" in both sites. But since they have two different forms, how can I make it with PHP so that I only have to search on a single page to do that assuming that the form uses the POST method and not the GET method?

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby sigix » Fri Sep 05, 2003 10:47 pm

you want to submit one value to 2 different forms ???

friend_al_23
New php-forum User
New php-forum User
Posts: 12
Joined: Sat Dec 28, 2002 6:30 pm
Location: Philippines
Contact:

Postby friend_al_23 » Fri Sep 05, 2003 10:49 pm

Something like that, I guess. And then print the result on a single page. No code needed. I just want to know to how to do it with PHP.

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Sat Sep 06, 2003 11:34 pm

friend_al_23 wrote:No code needed.


How do you figure? More appropriate would be "big bucket of code needed". Basically what you have to do is send the request to each page in turn and gather the returned data from each. HTTP at its finest. If you so desire, you can do this with sockets pretty easily, but I might recommend instead that you use one of the fine prefab HTTP GET/POST classes at PHPClasses.org.

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Postby WiZARD » Tue Sep 09, 2003 6:30 am

first you get what you want info what youre search.
second to you need to know what is URL string then you submit in youre browser....
for example in my browser than i try to search php i see
http://www.google.com.ua/search?q=php&h ... put=search
when to you need use script to open page like this:
http://www.google.com.ua/search?q=$search_string&hl=en&lr=&ie=UTF-8&oe=UTF-8&output=search

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Tue Sep 09, 2003 2:01 pm

WiZARD wrote:second to you need to know what is URL string then you submit in youre browser....
for example in my browser than i try to search php i see
http://www.google.com.ua/search?q=php&h ... put=search
when to you need use script to open page like this:
http://www.google.com.ua/search?q=$search_string&hl=en&lr=&ie=UTF-8&oe=UTF-8&output=search


I think you missed the boat, WiZ:

friend_al_23 wrote:assuming that the form uses the POST method and not the GET method?

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Postby WiZARD » Thu Sep 11, 2003 6:18 am

swirlee wrote:
WiZARD wrote:second to you need to know what is URL string then you submit in youre browser....
for example in my browser than i try to search php i see
http://www.google.com.ua/search?q=php&h ... put=search
when to you need use script to open page like this:
http://www.google.com.ua/search?q=$search_string&hl=en&lr=&ie=UTF-8&oe=UTF-8&output=search


I think you missed the boat, WiZ:

friend_al_23 wrote:assuming that the form uses the POST method and not the GET method?

but how?
i think what no Google.com no Yahoo! not give to you right's to use it only via GET method, but you may hide this if you wish not give to browser's see GET string.....


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest