Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php read json request body

//e.g your JSON Req is like this {"UserName":"Ranish","Password":"asdasdasd"}
$jsonReqUrl  = "php://input";
$reqjson = file_get_contents($jsonReqUrl);
$reqjsonDecode = json_decode($reqjson, true);
echo $reqjsonDecode['UserName'];
 
PREVIOUS NEXT
Tagged: #php #read #json #request #body
ADD COMMENT
Topic
Name
4+4 =