为什么卷曲输出有差异?

时间:2014-12-23 06:37:29

标签: curl response popen

给定here的代码段给出了输出

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    56    0    32  100    24    461    346 --:--:-- --:--:-- --:--:--   463
{"success": true}

但是当我直接在终端中给出相同的curl命令时,它输出为

{"success": true}

那么为什么这些输出之间存在差异?我只想在这里回复{"成功":真}。我不想要其他数据。我该怎么做?

我正在使用的Curl full命令是:curl -X POST -d' {" device_id":" 181CBBE"}' http://www.example.com/get_device_details

1 个答案:

答案 0 :(得分:1)

摘要转到stderr,回复转到stdout;您的popen命令仅返回stdout;使用curl -s来取消摘要