0

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");
3
  • You cannot execute PHP on site you do not own. This question should help: stackoverflow.com/questions/4565451/php-http-request Commented Jun 9, 2013 at 9:49
  • So i need to use HttpRequest? Commented Jun 9, 2013 at 9:53
  • Yes, you just need to send HTTP request Commented Jun 9, 2013 at 9:53

1 Answer 1

1

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...).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.