0
我的无知在此道歉。如何使用cURL将有效载荷发布到URL
我有以下有效载荷,我需要通过cURL(Mac Bash)发送到URL。
{“requestid":"2323423432",
"partnermatchid":"56d576ee-2d74-4dda-b8ff-d71b34311dd2",
"usercontext":{"ipaddressmasked":"209.252.7.186",
"useragent":"mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like
gecko) chrome/28.0.1500.95 safari/537.36",
"country":"us"},
"pagecontext":{"pagetypeid":"3","numslots":"6"},
"istest":false}
你能帮助使用命令语法来做到这一点吗?我试过了,但它在Bash中生成了怪异的HTML,我不明白发生了什么。
echo ‘{“requestid":"2323423432",
"partnermatchid":"56d576ee-2d74-4dda-b8ff-d71b34311dd2",
"usercontext":{"ipaddressmasked":"209.252.7.186",
"useragent":"mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, like
gecko) chrome/28.0.1500.95 safari/537.36",
"country":"us"},
"pagecontext":{"pagetypeid":"3","numslots":"6"},
"istest":false}’ | curl —data-binary @- http://www.thisistheurl.com
非常感谢!
curl --data“param1 = value1&param2 = value2”https://example.com/resource.cgi –
谢谢!所以我继续使用参数/值对。如果参数具有多个值,会发生什么情况?例如,requestid有一个值...但是usercontext在其中有几个参数/值对。 – amyyyyy
我认为这会很有用: http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request –