How to execute PHP code from the command line?


echo '<?php echo xxx;' | php

echo '<?php echo file_get_contents("https://www.example.com/test.php");' | php

echo '<?php echo file_get_contents("https://www.example.com/?fc=module&module=pagecache&controller=clearcache&token=xxX43XX0X7XxXXxx");' | php


References:

https://www.w3schools.com/php/func_filesystem_file_get_contents.asp

https://stackoverflow.com/questions/9520090/how-to-execute-php-code-from-the-command-line



Article ID: 17
Created On: Mon, Sep 7, 2020 at 1:47 AM
Last Updated On: Mon, Sep 7, 2020 at 1:47 AM
Authored by: Saeed Nobakht [[email protected]]

Online URL: https://www.navel.ir/article/how-to-execute-php-code-from-the-command-line-17.html