$headerSet=array(
'GET'.$url,
'Host: verify-email.org',
'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:28.0) Gecko/20100101 Firefox/28.0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: en-gb,en;q=0.5',
'Accept-Encoding: gzip, deflate',
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Proxy-Connection: Close',
'Cookie: __utma=67582614.1178183750.1396541997.1396541997.1396550804.2; __utmz=67582614.1396541997.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __atuvc=3%7C14; b38b8c1b3d6a4a2d4cc2696153b7cd63=lv63r03hdfq0p66ohv13brhlq5; __utmb=67582614.2.10.1396550804; __utmc=67582614',
'Cache-Control: max-age=0',
'Connection: keep-alive',
'DNT: 1'
);
$ch = curl_init(); // Initialising cURL
$data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable
curl_close($ch); // Closing cURL
return $data; // Returning the data from the function
现在添加此代码后,我尝试运行我的程序,但仍然没有设置标头。 我也检查了httpsfox。主机是localhost,但我希望主机设置为verify-email.org
答案 0 :(得分:0)
从标头数组中删除'GET'.$url,
。并将网址放在curl_init
$ch = curl_init($url); // <- url is placed here, and it will be GET by default
我没有看到你用你的卷曲设置$headerSet
。这样做是这样的:
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerSet);