Jump to content

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 ?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.