help with passing query strings please

Associate
Joined
16 Feb 2008
Posts
307
Location
Staffordshire
Hi,

I have been having problems a while now but through determination I think Iam nearly there.

I have a regular html form, lets say "landingpage"
It then sends a query string to "anotherpage.php" and displays the result.

all good now

well the problem is that I can call for example google.com and display the search but if I change the Url to my required one it loads a default site.

here is the code:

landingpage:

Code:
<form method="post" action="landingpage.php"  target=content>
        <input type="text"  name="lookfor" value="Search"  />
        <input type="submit" value="Search"/>
</form>

anotherpage:

Code:
<?php
if(!empty($_POST['lookfor'])){
   $url = "http://google.com/search?q=".$_POST['lookfor']; 
   $content = file_get_contents($url);
   echo $content;
}
?>

now I need to replace the google url (which works) with this:

http://www.*********.co.uk/modules/shop/searchrated.asp?

Ok it dosnt work, it has to be a query string problem i figure, or is it because Iam calling .asp from php?


cheers guys
 
You're taking form data and putting it into a URL, so you may need to URL encode it.

It doesn't matter what the languages in use are since the requests/responses are being marshalled through HTTP. You may need to look more closely at the specification of the .asp page (i.e. what does it require for input) and/or the parsing it is doing (if you have access to see that), in case it's doing something silly based on user agent (browser) detection for its responses or similar.
 
Back
Top Bottom