我有一个在我的 xampp 上运行良好的脚本,并且可以很好地处理以下位置。
但是现在我已经把它转移到服务器上,它不起作用。我刚收到301 moved permanently
网站。我的卷曲看起来像这样:
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_URL, $dir_url);
我已经尝试过错误报告:
error_reporting(E_ALL);
但它只是不输出任何错误......
有什么想法吗?
编辑:
//Start Curl Connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_URL, $dir_url);
//read content of $url
$result = curl_exec ($ch);
echo curl_error ($ch);
curl_close ($ch);