现象:
使用PHP的CURL相关函数进行POST,当要POST的参数内容长度超过1024时,将无法获得response的数据。
即:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
当 strlen($data) > 1024 时,curl_exec函数将返回空字符串。
解决:
增加一个HTTP header
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
参考资料:
http://stackoverflow.com/questions/463144/php-http-post-fails-when-curl-data-1024
http://www.php.net/manual/zh/function.curl-setopt.php#82418