Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 卷曲头之间的区别_Php_Curl_Paypal_Libcurl - Fatal编程技术网

Php 卷曲头之间的区别

Php 卷曲头之间的区别,php,curl,paypal,libcurl,Php,Curl,Paypal,Libcurl,cURL发送的以下标题之间有什么区别 $header="POST /cgi-bin/webscr HTTP/1.1\r\n"; $header .="Content-Type: application/x-www-form-urlencoded\r\n"; $header .="Host: www.paypal.com\r\n"; $header .="Connection: close\r\n\r\n"; 及 用于 curl_setopt($ch, CURLOPT_HTTPHEADER, $

cURL发送的以下标题之间有什么区别

$header="POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .="Content-Type: application/x-www-form-urlencoded\r\n";
$header .="Host: www.paypal.com\r\n";
$header .="Connection: close\r\n\r\n";

用于

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

我可以使用这两种方法设置cURL的头吗?谢谢

这两种方法都是错误的,尽管第二种方法的错误较小


两者都包括POST行,POST行是请求行,而不是定义为标题。因此,在header选项中包含该选项将创建一个错误的请求。(是的,它可能仍然有效)

文档()没有提到第一个解决方案,我会坚持使用第二个解决方案。你是对的,我也使用第二个解决方案,但我收到了PayPal的一封电子邮件,要求升级到HTTP 1.1,他们提到了第一个解决方案。标头必须是对象或数组。可以使用第二个解决方案,记住第一个解决方案中的标题值吗?是PayPal,忽略他们关于代码的所有内容。他们的网站速度慢得令人痛苦。
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);