curl
可以连接到任何 TCP 端口,而不仅仅是 HTTP/HTTPS
我需要检查开放端口,例如:11740
。
这可能吗?
最佳答案
是的,有可能,语法是curl [protocol://]<host>[:port]
,例如:
curl example.com:1234
如果您使用的是 Bash,您还可以使用 pseudo-device /dev
files打开 TCP 连接,例如:
exec 5<>/dev/tcp/127.0.0.1/1234
echo "send some stuff" >&5
cat <&5 # Receive some stuff.
关于php - curl 可以连接到任何 TCP 端口,而不仅仅是 HTTP/HTTPS 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20434620/