gpt4 book ai didi

linux - Linux上的curl命令打破json文本并获取反斜杠

转载 作者:太空宇宙 更新时间:2023-11-04 04:12:18 26 4
gpt4 key购买 nike

我在使用curl 命令时遇到一些问题。例如

$ curl --connect-timeout 2000  -v -X POST ....
* About to connect() to ************************
* Trying ::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to ********************
> POST ********************** HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
> Host: ******
> Accept: */*
> Content-Type: application/json
> Content-Length: 92
>
< HTTP/1.1 200 OK
< ****************:
< X-b: **************
< X-a: ***************
< Content-Type: application/json
< Content-Length: 8228
< Server: Jetty(6.1.26)


....
\"f1\":\"v1\"},\"f2\":{\"f3\":false},\"f4\":\"v4\",\"f5\":fa* Connection #0 to host localhost left intact
* Closing connection #0
lse,\"f6\":25}}"}}

注意,问题是:

  • json 被 \ 引用
  • 内容被 连接 #0 到主机本地主机完好无损关闭连接 #0

我的问题是:如何摆脱这些问题?

最佳答案

出现该错误消息是因为您可能连接了标准输出和标准错误。尝试重定向标准错误:

curl 2>/dev/null

要取消引用字符串,请参阅此处:Linux/Bash: How to unquote?

关于linux - Linux上的curl命令打破json文本并获取反斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18503376/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com