PHP uses Curl to show expect:100-continue solutions _php Tips

Source: Internet
Author: User
Tags curl

The example in this article describes the Expect:100-continue solution for PHP using curl. Share to everyone for your reference. Specifically as follows:

When using curl post data, if the post has more than 1024 bytes of data, curl does not initiate a POST request directly. But there are two steps.

1. Send a request that contains a expect:100-continue in the header that asks the server if it is willing to accept the data.
2. Post the data to the server only after receiving the 100-continue response returned by the server.

This is Libcurl definition, you can see the relevant description:

So there is a problem. Not all servers will respond to 100-continue. For example, LIGHTTPD will return "417 expectation Fail", which can cause logical errors.

The workaround is to include an empty expect in the header when sending the request.


I hope this article will help you with your PHP program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.