Reputation: 165
I have a url like this
localhost/handikap/insert/index.php?json={"id":123456}
and I want to get the json response out of it while I have written a code like this
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
but this is not returning anything Please help me out
Upvotes: 0
Views: 197
Reputation: 206
If you are using GET method
$data = $_GET['json'];
$data = json_decode();
print_r($data);
If you are using POST method
$data = file_get_contents('php://input');
$data = (array)json_decode($data,true);
Upvotes: 1