← All Articles

How to Read from stdin in PHP

Posted on

Reading from stdin in PHP is just like reading a file. The only difference is that the file to read is called php://stdin

<?php
echo file_get_contents('php://stdin');
polyglotbitsphpread-from-stdin