Today, We want to share with you php input.In this post we will show you Checking for “php://input” AND $_POST, hear for file_get_contents(“php://input”) or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request? we will give you demo and example for implement.In this post, we will learn about PHP CURL HTTP Request (GET & POST) with an example.
How do you access the php://input stream?
The php://input Data contains the raw data from a POST HTTP request, And then all of the HTTP headers. You can think of http simple $_POST as the same data (…sometimes) that has been parsed into an array.
php://input
gets the raw data. here The stream can be accessed in the following method using PHP:
get the raw POST data
<?php $response = file_get_contents("php://input"); //put in log file
The PHP script to retrieve raw HTTP data is as follows −
<?php $json = file_get_contents("php://input"); $data = json_decode($json); print_r($json); ?>
I hope you get an idea about check Empty – NULL in php.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.