$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 要请求的地址);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_GET, 1); // post,get 过去
$header[]= 'Accept-Language: zh-cn ';
$header[]= 'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) ';
$header[]= 'Host: my.xcar.com.cn';
$header[]= 'Connection: Keep-Alive ';
$header[]= 'Cookie: PHP获取的名字='.$_COOKIE['本地名字'];
curl_setopt($ch,CURLOPT_HTTPHEADER,$header); //放入头信息中
$filecontent = curl_exec($ch);
网友评论