Jump to content

problem with curl script


rhock_95

Recommended Posts

I am trying to use a curl script to retrieve a map based on form input

 

my form passes the data to the script and retrieves the map page but no map...however the URL is valid...i.e., if I take the same URL string following the "?" and paste it into the originating page the map displays

 

in the example below... after submitting the form (No Map displays) but if I copy the "coordinate string" and paste it over the coordinate string in the second example the map displays

 

[example]

 

mysite.com/curl_script.php?coordinate string  No map Displays

 

mapsite.com?/search.php?coordinate string    Map displays

 

here is the code I'm using:

    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, "http://www.mapsite.com/search.php?");
   
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    $result = curl_exec($ch);

    curl_close($ch);

    echo "$result";

Link to comment
https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/
Share on other sites

Try seeing if there is an error with cURL:

 

 

    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, "http://www.mapsite.com/search.php?");
   
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    $result = curl_exec($ch);
    echo curl_error($ch);
    curl_close($ch);

    echo "$result";

 

Edit: It could be that you need to set other headers/curl options to make this work. If the site you are connecting to shows different information based on user agent for example, then you'll need to pass that along.

It could be that you need to set other headers/curl options to make this work. If the site you are connecting to shows different information based on user agent for example, then you'll need to pass that along.

 

other than user agent what else should I look for in the http header logs ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.