简体   繁体   English

PHP-访问和发送数据以进行处理

[英]PHP - Accessing and sending data to process

I've been programming a small client-server-application and now I want to show the output of the server-process in a small server-webpage. 我一直在编写一个小型客户端服务器应用程序,现在我想在一个小型服务器网页中显示服务器进程的输出。 Everytime, you press a key in the server-console, the current state is output. 每次您按下服务器控制台中的一个键,就会输出当前状态。 Assuming, the server is running and I want to show the current state of the server, how would you implement this in PHP? 假设服务器正在运行,并且我想显示服务器的当前状态,那么如何在PHP中实现呢?

My thoughts were to get the process and then send a key input. 我的想法是得到流程,然后发送关键输入。 How could you implement this in PHP? 您如何在PHP中实现呢? The server is running on debian 6 with Apache and PHP 5.4. 该服务器在带有Apache和PHP 5.4的debian 6上运行。

Thanks in advance 提前致谢

Depend on how simple you want to go: 取决于您想走多简单:

  • the simplest would be to just simulate a get call. 最简单的方法就是模拟一个get调用。 for example, the client calls fopen(' http://server.example.com/status.php?server=myserver&stats=uptime '); 例如,客户端调用fopen(' http://server.example.com/status.php?server=myserver&stats=uptime '); and at the server level, look at $_GET['server'] and $_GET['uptime'] . 在服务器级别,查看$ _GET ['server']和$ _GET ['uptime']。 you can use that method and add authentication either by passing credentials as a variable. 您可以使用该方法并通过将凭据作为变量传递来添加身份验证。 The output can be either plain html or json encoded 输出可以是纯HTML或JSON编码的
  • use xml rpc or soap 使用xml rpc或soap
  • 声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM