PHP demo (more)




Call command-line

Call command-line to find out who we are running as.
Uses Linux ps to find owner of current process.
Put this code in your PHP page and see what it does:

   
<?php

$cmd = "ps -p $$ -o user,ruser";

$output = shell_exec ( $cmd );

print ("<pre> $output </pre>");			
		 
?>



Make HTTP request

Put this code in your PHP page and see what it does:

   
<?php

$url = SOMEURL;

$x = file_get_contents ( $url );

echo $x;
		 
?>