Skip to content

Instantly share code, notes, and snippets.

@Zvax
Created July 26, 2017 19:58
Show Gist options
  • Save Zvax/49e0de93ae25a8dbfc6e23b5b69c928c to your computer and use it in GitHub Desktop.
Save Zvax/49e0de93ae25a8dbfc6e23b5b69c928c to your computer and use it in GitHub Desktop.
reading data from request body
$inputStream = fopen("php://input", "r");
$contents = '';
while (!feof($inputStream)) {
$contents .= fread($inputStream, 8192);
}
fclose($inputStream);
$dataFromRequest = json_decode($contents, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment