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

19 Replies, 2364 Views

Nope, no such thing as curl --post. Use `-d` or `--data` instead.

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

For JSON, add the header:
`curl -H "Content-Type: application/json" -d '{"name":"foo"}' https://example.com`

Bonus: Use `-v` to see verbose output and debug.

Messages In This Thread



Users browsing this thread: 1 Guest(s)