How to read GET and POST request in PHP (post is in json) -
i have javascript (not me) sync information between client (javascript) , server (php) , javascript send server , post information, can read easy information try read $_post
information , cannot retrieve post information.
i try print_r($_post)
, returns array()
nothing.
i try firebug , console firefox , see that
how can retrieve , treat json string >transmission de la requete< php code? can retrieve parameters such token, src , etc can't retrieve post transmission.
thank helping !
i don't you. since it's json request sent page. can use file_get_contents('php://input')
grab json request sent. can decode object or array.
example
$request = file_get_contents('php://input');
to obtain object
$input = json_decode($request);
so input fields be
$input->name; $input->password;
to obtain array
$input = json_decode($request, true);
so input fields be
$input[name]; $input[password];
Comments
Post a Comment