rhock_95 Posted October 28, 2007 Share Posted October 28, 2007 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"; Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/ Share on other sites More sharing options...
GingerRobot Posted October 28, 2007 Share Posted October 28, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-379997 Share on other sites More sharing options...
rhock_95 Posted October 28, 2007 Author Share Posted October 28, 2007 Try seeing if there is an error with cURL not getting any errors...is there a special function to echo cURL errors? Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-380024 Share on other sites More sharing options...
GingerRobot Posted October 28, 2007 Share Posted October 28, 2007 Yes. Its in the code i posted. Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-380031 Share on other sites More sharing options...
rhock_95 Posted October 28, 2007 Author Share Posted October 28, 2007 oops...thanks Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-380032 Share on other sites More sharing options...
rhock_95 Posted October 28, 2007 Author Share Posted October 28, 2007 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-380037 Share on other sites More sharing options...
GingerRobot Posted October 28, 2007 Share Posted October 28, 2007 It rather depends on the website. I had one cURL request which failed due to a problem with the SSL certificate; for other sites you may need to specify a cookie etc. Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-380040 Share on other sites More sharing options...
rhock_95 Posted October 28, 2007 Author Share Posted October 28, 2007 you may need to specify a cookie etc. can you show me how this is done? Quote Link to comment https://forums.phpfreaks.com/topic/75130-problem-with-curl-script/#findComment-380053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.