How to solve the problem of Expect:100-continue when php uses curl
This article mainly shows you "how to solve the problem of Expect:100-continue in the use of curl in php", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn "how to solve the problem of Expect:100-continue in the use of curl in php".
The details are as follows:
When using curl POST data, curl does not directly initiate a POST request if the POST data is greater than 1024 bytes. It will be divided into two steps.
1. Send a request with an Expect:100-continue in the header asking Server if it is willing to accept the data.
two。 The data is not POST to Server until the 100-continue response returned by Server is received.
This is defined by libcurl. For more information, please see the description: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3
So there will be a problem. Not all Server will respond to 100-continue. Lighttpd, for example, returns "417 Expectation Fail", causing a logic error.
The solution is to send the request with an empty Expect in the header.
Curl_setopt ($ch, CURLOPT_HTTPHEADER, array ("Expect:"); these are all the contents of the article "how to solve the Expect:100-continue problem in php using curl". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!