Sending POST request data stored in a variable using curl, sends $variable instead json data.
P=`/usr/bin/sudo /usr/bin/curl -X POST -H "Content-Type:application/json" --data-urlencode $data http://127.0.0.1/abc.php`
Trying to send POST request to php, but it receives $data instead json data{"abc":"11","xyz":"20"}
.
Had try with '$data', "$data", \'$data\' and \"$data\", where $data = {"abc":"11","xyz":"20"}
Please give an example that works. Thanks in advance.