我正在尝试在命令提示符中执行以下行:
curl -X POST -d '{ "method" : "account_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"} ] }' http://s1.ripple.com:51234
但是,我得到以下内容:
curl: (6) Could not resolve host: method
curl: (7) Failed connect to :80; No error
curl: (6) Could not resolve host: account_info,
curl: (6) Could not resolve host: params
curl: (7) Failed connect to :80; No error
curl: (3) [globbing] illegal character in range specification at pos 2
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: account
curl: (7) Failed connect to :80; No error
curl: (3) [globbing] unmatched close brace/bracket at pos 35
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (3) [globbing] unmatched close brace/bracket at pos 1
unable to parse request
我在Windows上,错误与引号,大括号和通配符有关。我尝试使用反斜杠替换引号,但没有运气。
我确信我只需要以正确的方式逃避正确的事情,但我很难做到这一点。一些帮助将受到高度赞赏。
答案 0 :(得分:49)
试试这个:
curl -X POST -d "{ \"method\" : \"account_info\", \"params\" : [ { \"account\" : \"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh\"} ] }" http://s1.ripple.com:51234
答案 1 :(得分:36)
您可以使用curl -g
关闭globbing:
curl -g -X POST -d '{ "method" : "account_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"} ] }' http://s1.ripple.com:51234
比逃避所有这些括号更容易。
答案 2 :(得分:1)
尝试基本的发布内容。
curl -X POST --data '{"username":"username", "password":"password"}' --header "Content-Type:application/json" http://127.0.0.1:8000/your_url/
答案 3 :(得分:0)
在上述回复中,请务必注意以JSON格式指定数据,这应要求将-header 指定为@Alok答案。
也可以按以下“ url”格式定义它:
curl -X POST --data "method=account_info¶ms=[…]" http://s1.ripple.com:51234
,并避免指定-标头“ Content-Type…”