各种妖孽

php cURL模拟POST请求,碰到这样的错误:

HTTP/1.0 417 Expectation failed
Server: squid
Date: Fri, 02 Mar 2012 16:08:46 GMT
Content-Type: text/html
Content-Length: 1563
X-Squid-Error: ERR_INVALID_REQ 0
X-Cache: MISS from none.net
Via: 1.0 none.net:80 (squid)
Connection: close

请求头
POST /abc.php HTTP/1.1
User-Agent: Internal Callback
Host: www.abc.com
Accept: */*
Content-Length: 14598
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

解决方案:设置CURLOPT_HTTPHEADER为array(‘Expect:’)

参考链接:
http://chrismckee.co.uk/curl-http-417-expectation-failed/
http://www.shesek.info/php/http-error-417-with-php-curl


评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注