PHP Executing A External Script

Status
Not open for further replies.

rockhard

Less Is More
Apr 24, 2008
1,050
13
0
Which is the best command to use if I need to execute a external script?
File get contents seems unnecessary here...

PHP:
for($i = 0; $i < count($array); $i++) {

    $foo = file_get_contents($array[$i]);

}
 


You can use the exec function to execute scripts in PHP. Just be very careful not to have any way for a user to inject commands into that function call.
 
put it in a password protected web accessable directory and...
Code:
$return = file_get_contents('http://username:password@domain.com/directory/script.php');
 
Status
Not open for further replies.