I am using below syntax to post some json Data to my URL
curl -H 'Content-Type:application/json' -X POST -d '{"username":"davidwalsh","password":"something"}' http://myProjectURL
i would like to get this json string in array in my php function
but currently when i try to print the post variable like
echo "<pre>";
print_r($post);
die();
it gives me output
<pre>Array
(
['] => Array
(
[{username:davidwalsh,password:something}] =>
)
)
expected Output :
Array(
"username" => "davidwalsh",
"password" => "something"
)
I am referring this
Though my question is marked as duplicate but i would like to inform you that i am not able to get the each parameter i have sent through json .
I am getting all the array
key
values
as a single array key which is absolutely wrong.