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
webdevetc

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



More...


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

What are Apache MPMs?

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

How to check if a user is logged in, inside a blade file?

How to find the average value of items in a Laravel Collection?

How to redirect your website to a new domain/location in .htaccess

How to prevent Eloquent from adding created_at or updated_at timestamps?

How to undelete a soft deleted Eloquent row?

How to group a SQL statement in brackets/parenthesis

How do you launch the PHP interactive shell?

How to get table column names from a database table in Eloquent?