gpt4 book ai didi

bash - 如何创建一个 Bash 监听器来接收 PHP 请求?

转载 作者:行者123 更新时间:2023-12-04 05:40:19 26 4
gpt4 key购买 nike

我目前正在使用带有 PHP 的 Apache 服务器来监听来自另一台服务器的请求。服务器要么加载带有参数的页面 (GET),要么将值发布到页面 (POST) 以触发事件。

我想知道是否可以让 Bash 监听器来监听请求,而不是让整个 Apache 服务器来监听。

如果这是可能的,我会怎么做?它必须能够执行其他 Bash 脚本。我目前的方法使用 PHP 的 exec 函数,我认为它没有优化速度。

最佳答案

来自“男人 bash”:

/dev/tcp/host/port
If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a TCP connection to the corresponding socket.



Here是一个与 Bash 一起分发的 Web 服务器。

在我的系统上,它的 /usr/share/doc/bash/examples/scripts/websrv.sh

关于bash - 如何创建一个 Bash 监听器来接收 PHP 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11349778/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com