Curl不会从开发服务器发送cookie,但是当我从另一台服务器运行脚本时,它运行良好。我无法理解开发服务器的错误。
$curl=curl_init($request);
//$cook = './cook/1.txt';
//curl_setopt($curl, CURLOPT_COOKIEJAR, $cook);
//curl_setopt($curl, CURLOPT_COOKIEFILE, $cook)
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36");
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
//curl_setopt($curl, CURLOPT_ENCODING, 'UTF-8');
curl_setopt($curl, CURLOPT_VERBOSE,1);
curl_setopt($curl, CURLINFO_HEADER_OUT,1);
curl_setopt($curl, CURLOPT_COOKIE, "departureCity=2; path=/;");
$out = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
$信息:
Array
(
[request_header] => GET /hotels/greece/showhotel/12_islands_villas_26 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Host: SITE
Accept: */*
Referer: SITE
)
标题
中现在有cookie数据