Jac*_*mes 17 rest curl command-line-interface
有关如何在执行PHP版本请求时防止curl显示头信息的大量信息,但似乎没有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
Run Code Online (Sandbox Code Playgroud)
哪个有效,但返回此:
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}
Run Code Online (Sandbox Code Playgroud)
当我真正想要的是这个:
{"code":"jkhjhhjhaa","state":null}
Run Code Online (Sandbox Code Playgroud)
Gil*_*not 37
只需-i从curl命令中删除开关即可.
man curl
Run Code Online (Sandbox Code Playgroud)
说过 :
-i, -
include(HTTP)在输出中包含HTTP标头.HTTP标头包括服务器名称,文档日期,HTTP版本等等...
小智 8
为了抑制CURL CLI的输出,可以使用--silent选项.当卷曲输出也是管道输出时,它非常有效.
-s, --silent Silent mode (don't output anything)
Run Code Online (Sandbox Code Playgroud)