Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of Expect:100-continue when php uses curl

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report