开发者

Sending a script from PHP file

开发者 https://www.devze.com 2023-02-22 07:24 出处:网络
Does anyone know if it is possible to send a command line script from a php page to another server from which the php file is not on? So Php file is on server A and t开发者_开发知识库he command line s

Does anyone know if it is possible to send a command line script from a php page to another server from which the php file is not on? So Php file is on server A and t开发者_开发知识库he command line script needs to be run on server B. Both are hosted locally but on seperate machines.

I dont think it is possible but just want to see if anyone else has tried it or knows it doesnt work either.

Thanks, Mike


It is possible to make a PHP script log on to another server using SSH, but it's very complicated.

It's probably much, much easier to have a publicly accessible PHP file on the remote server, call that through the web, and have it perform whatever actions you need.


What you describe can be done as a a simple "REST service" which Pekka described.

You should also research "RPC" (Remote Procedure Call) and "SOAP" as well.

Both of those come with some baggage, and both are probably overkill, but they are solutions to the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消