尝试使用Curl时出现以下致命错误:
set_time_limit(0);
$url = '$url';
$ch = curl_init();
$proxy = "8.8.8.8";
$port = "8080";
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, "HTTP");
curl_setopt($ch, CURLOPT_PROXYPORT, $port);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,1000);
//curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
$headers = array(
'user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36',
'x-requested-with:XMLHttpRequest',
'vary:Accept-Encoding',
'x-powered-by:PHP/7.1.0',
'cf-ray:4b8e31281f84b049-IST',
'device:d'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//curl_setopt($curl,CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36");
$data = curl_exec ($ch);
//代理是一个示例。
我仅列出和解析目标站点上的一个类别时不会出错,但是尝试列出所有类别时却出现此错误
我该如何解决这个问题?