php get post body code example
Example 1: php post
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="fname">
<input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// do logic
$name = $_POST['fname'];
}
?>
Example 2: fetch body show in php code
$entityBody = file_get_contents('php://input');
Example 3: fetch body show in php code
$entityBody = stream_get_contents(STDIN);