Jump to content

Curl script not working on host


Uruviel

Recommended Posts

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

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); 

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.