How to execute an external program and display the output using system() in PHP

4 Answers

0 votes
// string system( string $command [, int &$return_var ])

$last_line = system('dir *.*', $return_var);
 

 
/*
run:
     
Volume in drive C has no label. Volume Serial Number is 1Q2E-X8V3 Directory of C:\xampp\htd...
. 07/20/2016 10:04 PM 
.. 07/20/2016 11:56 PM 13,911 account.php 07/13/2016 11:59 PM 
bootstrap-3.3.6 07/20/2016 10:00 PM 
bootstrap-3.3.6-source 02/20/2016 01:18 AM 719 connection.php 06/14/2016 10:49 AM 
...
     
*/

 



answered Jul 21, 2016 by avibootz
0 votes
system("calc.exe"); // system("calc");

 
/*
run:

    
*/

 



answered Jul 21, 2016 by avibootz
0 votes
system("notepad"); // system("notepad.exe");

 
/*
run:

    
*/

 



answered Jul 21, 2016 by avibootz
0 votes
system("mspaint"); 
 
/*
run:


    
*/

 



answered Jul 21, 2016 by avibootz

Related questions

2 answers 274 views
274 views asked Jun 15, 2016 by avibootz
1 answer 186 views
1 answer 279 views
3 answers 296 views
...