从流中获取数据后如何将数据恢复?

I am getting post data like this

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

I want the data put back to the stream, so I modified the method following instaed of above method

$stream = fopen('php://temp', 'w+');
stream_copy_to_stream(fopen('php://input', 'r'), $stream);
rewind($stream);

But it is not working. Can any one tell where I did wrong? This case is need in wordpress plugin developement. If one plugin reads the post data, other plugin not able to get that data.
Thanks

As stated in the documentation, php://input can only be read once and doesn't support seek operations.

The only way to 'read' the input stream multiple times is through passing its copy in your program.

PHP input stream contains request body and your sample will work only if request will contain body.

curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache"  -d 'sample body' "YOUR_ADDRESS"

For check add to code:

echo fgets($stream);

php://input is not available with enctype="multipart/form-data".

http://php.net/manual/en/wrappers.php.php