This is a discussion on Sending POST-data within the PHP General forums, part of the PHP Programming Forums category; I'm making a search-engine script for my site that redirects users to other search engines. Point is that ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm making a search-engine script for my site that redirects users to other search engines. Point is that on the website, there's a drop-down box with some engines and one textfield. 1. User enter the search query. 2. User selects which engine to use. 3. User submits. 4. PHP scripts checks which engine and redirects the user and the query to the selected engine. Now the thing is that some of these engines use POST method, which makes it a bit harder to redirect the query. For those who use GET I just have to use something like Header("Location: http://somewnine.com/query=$query"); So, does anyone have any good solution to this problem? //Simon |
|
|||
|
--- Simon Fredriksson <simon@lan2k.org> wrote:
> Now the thing is that some of these engines use POST method, > which makes it a bit harder to redirect the query. For those > who use GET I just have to use something like > header("Location: http://somewnine.com/query=$query"); > > So, does anyone have any good solution to this problem? You have to either let the user POST (rather than redirecting from your site to the target) or send the POST request yourself and display the result to the user. If you choose the latter, search the archives for sample code to send POST requests from PHP. Chris ===== Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ |
|
|||
|
Output the required form with hidden fields from your script and use
onload="document.forms[0].submit();" Simon Fredriksson wrote: > > I'm making a search-engine script for my site that redirects users to > other search engines. Point is that on the website, there's a drop-down > box with some engines and one textfield. > > 1. User enter the search query. > 2. User selects which engine to use. > 3. User submits. > 4. PHP scripts checks which engine and redirects the user and the query > to the selected engine. > > Now the thing is that some of these engines use POST method, which makes > it a bit harder to redirect the query. For those who use GET I just have > to use something like Header("Location: > http://somewnine.com/query=$query"); > > So, does anyone have any good solution to this problem? > > //Simon > > |