您好,欢迎访问一九零五行业门户网

php curl如何设置头部信息

php curl设置头部信息的方法:首先把自定义http头放入hearders array中;然后用“curlopt_httpheader”进行设置即可。
推荐:《php视频教程》
php curl设置自定义的http头
把自定义http头放入hearders array, 然后用curlopt_httpheader设置。
$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);
以上就是php curl如何设置头部信息的详细内容。
其它类似信息

推荐信息