PHP input stream php://input usage example (php sends image stream to server)
From the official website information, php://input is a read-only information stream. When the request method is post and enctype is not equal to "multipart/form-data", you can use php://input to obtain the original request. The data.
Look at a simple example.
The client is just a form, very simple.
<form action="" method="POST"> name: <input type="text" name="name" value="tom" /><br /> age:<input type="text" name="age" value="22" /><br /> <input type="submit" value="Submit" /> </form>
Submit the form to the server, and the server uses file_get_contents to obtain the content of php://input
$content = file_get_contents("php://input"); echo $content; //输出name=tom&age=22
In the description of php://input on the official website, the variable $HTTP_RAW_POST_DATA is repeatedly mentioned. This variable is actually the same as file_get_contents( php://input) are the same. If you want to enable this variable, you need to modify the configuration file, find the option always_populate_raw_post_data, set it to On, and then restart the web server. That's it. Using php://input does not require modifying the php configuration file.
In project applications, such as taking photos with the camera, uploading and saving, you can use php://input. After the client takes a photo, it sends the image stream to the server. The server uses file_get_getcontents('php://input') to get the image stream, and then saves the image stream to a file. This file is the image.
For more php input stream php://input usage examples (php sends image streams to the server) related articles, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6
Visual web development tools