How do you access the php://input stream?

October 26, 2018

The php://input contains the raw data from a POST request, after all of the HTTP headers. You can think of $_POST as the same data (...sometimes) that has been parsed into an array. php://input gets the raw data. The stream can be accessed in the following way:

<?php
$val = file_get_contents("php://input");