PHP uses curl to appear expect:100-continue solution
This article mainly introduces PHP using curl appeared expect:100-continue solution, the example analyzes the expect:100-continue appearance principle and the solution method, has the certain reference value, needs the friend to refer to under
The examples in this article describe the Expect:100-continue workaround for PHP using curl. Share to everyone for your reference. Specific as follows:
When using the Curl post data, if the post data is greater than 1024 bytes, curl does not directly initiate the POST request. But it will be in two steps.
1. Send a request with a expect:100-continue in the header that asks if the server is willing to accept the data.
2. After accepting the 100-continue response returned by the server, the data is not post to the server.
This is libcurl defined, can be seen in the relevant description: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3
So there is a problem. Not all servers will respond to 100-continue. For example, LIGHTTPD returns "417 expectation Fail", which can cause a logic error.
The workaround is to include an empty expect in the header when sending the request.
?
1 |
curl_setopt ($ch, Curlopt_httpheader, Array ("Expect:")); |
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/964001.html www.bkjia.com true http://www.bkjia.com/PHPjc/964001.html techarticle PHP uses Curl to appear expect:100-continue solution This article mainly introduces PHP using Curl to appear expect:100-continue solution, the example analyzes expect:100- The principle and solution of continue ...