Solution to Expect:100-continue when php uses curl_PHP tutorial

WBOY
Release: 2016-07-13 10:05:01
Original
1048 people have browsed it

Solution to Expect:100-continue when using curl in php

This article mainly introduces the solution to Expect:100-continue when using curl in php. An example analysis of Expect:100 -The principles and solutions of continue have certain reference value. Friends in need can refer to it

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

When using curl POST data, if the POST data is larger than 1024 bytes, curl will not directly initiate a POST request. Instead, it will be done in two steps.

1. Send a request with an Expect:100-continue in the header to ask the server if it is willing to accept data.
2. After receiving the 100-continue response returned by the server, POST the data to the server.

This is defined by libcurl. For details, you can view the relevant description: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3

So a problem will arise. Not all servers will respond with 100-continue. For example, lighttpd will return "417 Expectation Fail", which will cause logical errors.

The solution is as follows: when sending a request, the header contains an empty Expect.

?

1

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));

1
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));

I hope this article will be helpful to everyone’s PHP programming design.

http://www.bkjia.com/PHPjc/964001.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/964001.html
TechArticle
php expect:100-continue occurs when using curl. This article mainly introduces the solution of Expect:100 when php uses curl. -continue solution, an example analysis of the principles and solutions of Expect:100-continue...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!