Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Receive JSON POST Data with PHP
<?php
$data = json_decode(file_get_contents('php://input'));
$myVariable = $data->{'foo'};
$myOtherVariable = $data->{'bar'};
?>
{
"foo": "<?= $myVariable ?>",
"bar": "<?= $myOtherVariable ?>"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment