PHP Curl Error: 417-expectation Failed

Source: Internet
Author: User

When I add a piece of content to the post submission, I get an error: 417-expectation Failed.

Data found that when using curl for post, when the post data is greater than 1024 bytes, curl does not directly initiate the POST request, but is divided into two steps,

1. Send a request that contains a exc:100-continue that asks the server to receive the data

2. After receiving the server return 100-continue answer, the post is submitted to the server

RFC related information: https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3

However, my router is using LIGHTHTTPD, it does not answer 100-continue correctly, so it returns 417 this error

The workaround is to add this option:curl_setopt ($ch, Curlopt_httpheader, Array (' Expect: '));

PHP Curl Error: 417-expectation Failed

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: info-contact@alibabacloud.com 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.