9951 explained code solutions for 126 technologies


curlHow to post JSON data


curl -H "Content-Type: application/json" -X POST -d '{"var1":"val1"}' https://example.org/script.phpctrl + c
Content-Type: application/json

set JSON content type for our request

-X POST

make this a POST request

-d

specify data we want to post

'{"var1":"val1"}'

JSON in plain text we're going to post

example.org/script.php

example script to post data to