1, curl can only crawl part of the content of the page reason analysis:
Error hint: CURL transport Error:transfer closed with outstanding read data remaining
Libcurl enable the "Expect:100-continue" feature when sending more than 1024 bytes of data:
When using curl for post, when the data to post is greater than 1024 bytes, curl does not directly initiate the POST request, but is divided into two steps: 1. Sends a request that contains a "expect:100-continue" header field that asks if the Server is willing to receive data; 2. After receiving the 100-continue answer returned by the server, the data is POST to the server, which is the behavior of Libcurl.
First,Libcurl takes this approach when sending a POST request that is larger than 1024 bytes, but in contrast, it causes a greater request delay.
Second, not all Web servers can correctly handle and answer "100-continue", such as LIGHTTPD, and return 417 "expectation Failed", resulting in a request logic error. (Zheng note 1:LIGHTTPD version 1.4 has this serious problem, fixed in version 1.5.) Zheng Note 2:resin added support for expect:100-continue in version 3.0.5. )
Workaround: Modify the Curlopt entry:
Curlopt_httpheader = = Array ("Content-type:application/binary") is changed to Curlopt_httpheader = = Array (" Content-type:application/binary "," Expect: ")
Using Curl in PHP (a)