php curl post请求中携带header参数

php curl post请求中携带header参数,第1张

概述curl_setopt($ch,CURLOPT_HTTPHEADER,Array("Content-Type:text/xml"));或者$header[0]="Accept:text/xml,application/xml,application/xhtml+xml,";$header[0].="text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
curl_setopt($ch, CURLOPT_httpheader, Array("Content-Type: text/xml")); 或者  $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";   $header[0] .= "text/HTML;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";   $header[] = "Cache-Control: max-age=0";   $header[] = "Connection: keep-alive";   $header[] = "Keep-Alive: 300";   $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";   $header[] = "Accept-Language: en-us,en;q=0.5";   $header[] = "Pragma: "; // browsers keep this blank.   curl_setopt($curl, CURLOPT_httpheader, $header); 转载自:https://www.cnblogs.com/devcjq/articles/6080391.html

参考:

https://www.php.net/manual/zh/function.curl-setopt.php

里面的 CURLOPT_httpheader 属性。

注意 CURLOPT_httpheader 的格式:使用示例

//设置 $headers = [            'Content-Type:application/plan',            'pf:'.$pf        ];// 使用curl_setopt($ch, CURLOPT_httpheader,$headers);

 

总结

以上是内存溢出为你收集整理的php curl post请求携带header参数全部内容,希望文章能够帮你解决php curl post请求中携带header参数所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1001831.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存