faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 8 people (25%) answered Yes
Recently 2 of 8 people (25%) answered Yes

Entry

Is there a way in PHP that I can run a script locally on a machine from a remote location?

Mar 1st, 2008 06:46
dman, Erich Kolb, Nick s, http://www.ttnr.org


Although it is extremely dangerous to do so, there are ways.
If you want to execute a command, and then output it as it would look 
in a 
terminal, with newlines and all, do this:
$output = shell_exec($command);
$output = str_replace("\xa","",$output);
echo($output);
This will make it substitute the newlines for  tags, so you get a
normal output.