Uruviel Posted February 14, 2010 Share Posted February 14, 2010 I've made a script to parse a page using curl, on my laptop it all works well. On my host it doesn't, it isn't giving me any errors either, so I'm clueless. This script below works on my laptop for both urls, on my host it only works for the commented url. <?php $target_url = "http://landofconfusion.freedkp.org/frx/listmembers.php?show=all"; //$target_url = "http://loc.uruviel.be"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$target_url); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_COOKIEJAR, "./my_cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "./my_cookies.txt"); $html = curl_exec($ch); if (!$html) { echo "cURL error number:" .curl_errno($ch); echo "cURL error:" . curl_error($ch); } var_dump($html); Link to comment https://forums.phpfreaks.com/topic/192018-curl-script-not-working-on-host/ Share on other sites More sharing options...
Garethp Posted February 14, 2010 Share Posted February 14, 2010 Did you make sure that the server supports CURL? Did you turn error reporting on? Link to comment https://forums.phpfreaks.com/topic/192018-curl-script-not-working-on-host/#findComment-1012051 Share on other sites More sharing options...
Uruviel Posted February 14, 2010 Author Share Posted February 14, 2010 Yes curl is supported, it shows in the php info and the script works for another url (the commented one). Display_errors is on and I've added the following line to the script with the same end result. error_reporting(E_ALL); ini_set("display_errors", 1); Link to comment https://forums.phpfreaks.com/topic/192018-curl-script-not-working-on-host/#findComment-1012144 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.