在linux上,千万不要用
curl_setopt($ch, CURLOPT_POST, true);
改用
curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'POST');
原因:https://sevalapsha.wordpress.com/2011/08/03/curl-http11-empty-post-bug/
Later we found that the same request gets accepted if sent from a client other than cURL (e.g. chrome-poster). The unique about this request is that it’s sent with POST method (the vendor’s strict requirement) but the content body is empty.
In the end we discovered that newer version (since 7.20) of cURL interprets missing body as a negotiation request – sends Expect: 100-continue header and Content-Length: -1.
So, the immediate solution was to send empty content body (zero-length string) to cURL, which aligned the behavior in all the environments.