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

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

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:

  1. $val = file_get_contents("php://input");

webdevetc profile pic

I am a 29 year old backend web developer from London, mostly focusing on PHP and Laravel lately. This ( is my blog where I write about some web development topics (PHP, Laravel, Javascript, and some server stuff). contact me here.


Comments and discussion about How do you access the php://input stream?

Found this interesting? Maybe you want to read some more in this series?

Or see other topics in the PHP language

Or see other languages/frameworks:
PHP Laravel Composer Apache CentOS and Linux Stuff WordPress General Webdev and Programming Stuff JavaScript
Or see random questions

How to find out which php.ini file PHP is using?

How to set the Expires header in .htaccess

How to add the CSRF (Cross-site request forgery) token in Laravel?

What is the loop variable in a @foreach loop in Blade?

What is the max size, by default, of GET variables?

How do you run a PHP script from the command line?

How to group a SQL statement in brackets/parenthesis

How to block IPv6 IP addresses in .htaccess

How to namespace a Laravel route group?

How to find the index of a value in an array in JS?