Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

php://input

php://input is a special read-only stream that gives access the raw body of an incoming HTTP request. It does not work with CLI environment.

When a browser sends data to the web server, PHP parses it into superglobals like $_POST. But sometimes the exact raw payload is needed: that’s where php://input comes in.

The raw data used to be accessed via $HTTP_RAW_POST_DATA, but this is a deprecated feature.

<?php

    $incoming = file_get_contents('php://input');

?>

Documentation

See Also