Reputation: 23
Hello i want to ask how to exec external php script with exec()
which is not located on my website
Does it work like this ?
exec("php http://site.com/executor.php?something=1&something2=A");
Upvotes: 0
Views: 79
Reputation: 6809
No, because when using HTTP the remote server sends the result of the PHP script. The command doesn't support URLs just because of that. If you want to execute the code on the remote server you need to have access to the PHP file itself. If you just need the result, you can use e.g.
readfile("http://site.com/executor.php?something=1&something2=A")
or other ways to read from URLs (fopen
and fread
, file_get_contents
, file
...).
Upvotes: 1