设置CURL头信息

来源:互联网 发布:鞋子淘宝试用报告范文 编辑:程序博客网 时间:2024/05/01 03:21
$headers = array();
$headers[] = 'X-Apple-Tz: 0';
$headers[] = 'X-Apple-Store-Front: 143444,12';
$headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
$headers[] = 'Accept-Encoding: gzip, deflate';
$headers[] = 'Accept-Language: en-US,en;q=0.5';
$headers[] = 'Cache-Control: no-cache';
$headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=utf-8';
$headers[] = 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0';
$headers[] = 'X-MicrosoftAjax: Delta=true';

/*

$header = array (  
 "POST {$path}?{$query} HTTP/1.1",  
 "Host: {$temp['host']}",  
 "Content-Type: text/xml; charset=utf-8",  
 'Accept: */*',  
 "Referer: http://{$temp['host']}/",  
 'User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1)',  
 "X-Forwarded-For: {$myIp}",  
 "Content-length: " . strlen($xml) ."\r\n\r\n" .$xml,  //修改1  
 "Connection: Close"  
 );  

*/



curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
0 0