0

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

1
  • 1
    If you are getting response from $_GET then you can use $data= json_decode($_GET['json']); Commented Sep 5, 2015 at 6:08

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.