


Solution to Expect:100-continue when php uses curl_PHP tutorial
Jul 13, 2016 am 10:05 AMSolution 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.
?
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));
|
I hope this article will be helpful to everyone’s PHP programming design.
TechArticle
Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
