Wednesday, October 23, 2013

How to post json with curl

i needed to test a php script by posting a json body in the request with curl from the debian linux command line. below is the solution i found.

curl -X POST -H "Content-Type: application/json" -d '{"key": "value"}' http://localhost/myscript.php


info taken from:
http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest

No comments: