How do I properly use curl --post to send data in a request? or What's the correct syntax for curl --

19 Replies, 2365 Views

You’re missing the `-d` flag! curl --post isn’t a real option.

Form data:
`curl -d "name=foo&age=25" https://example.com`

JSON:
`curl -X POST -H "Content-Type: application/json" -d '{"name":"foo"}' https://example.com`

`-X POST` is optional here since `-d` implies POST.

Messages In This Thread



Users browsing this thread: 1 Guest(s)