Jun
08
2017
php curl设置自定义的HTTP头
小V今天碰到比较坑的问题,一直以为参数是'item'=>'value'这么写的,没想到是'item:value'这样的。
$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'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
发表评论: