有很多关于如何防止 curl 在请求 PHP 版本时显示标头信息的信息,但对于 CLI 版本似乎没有。
我的要求是
curl -i -X POST -H 'Content-Type: application/json; charset=UTF-8' -H 'X-Accept: application/json' -H '-d '{"somedata":"12ihiuhihihed994f63dbef6b012b"}' https://myurl.com/v3/oauth/request
哪个有效,但返回:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json
Date: Wed, 27 Mar 2013 20:42:11 GMT
P3P: policyref="/w3c/p3p.xml", CP="ALL CURa ADMa DEVa OUR IND UNI COM NAV INT STA PRE"
Server: Apache/2.2.23 (Amazon)
Status: 200 OK
X-Powered-By: PHP/5.3.20
Content-Length: 54
Connection: keep-alive
{"code":"jkhjhhjhaa","state":null}
当我真正想要的是:
{"code":"jkhjhhjhaa","state":null}