ken*_*orb 22
是的,有可能,语法是curl [protocol://]<host>[:port],例如:
curl example.com:1234
Run Code Online (Sandbox Code Playgroud)
如果您正在使用Bash,您还可以使用伪设备/dev文件打开TCP连接,例如:
exec 5<>/dev/tcp/127.0.0.1/1234
echo "send some stuff" >&5
cat <&5 # Receive some stuff.
Run Code Online (Sandbox Code Playgroud)
另请参阅:有关使用Bash的内置/ dev/tcp文件(TCP/IP)的更多信息.
由于您使用的是 PHP,您可能需要使用该CURLOPT_PORT选项,如下所示:
curl_setopt($ch, CURLOPT_PORT, 11740);
请记住,您可能会遇到 SELinux 的问题:
当然:
curl http://example.com:11740
curl https://example.com:11740
Run Code Online (Sandbox Code Playgroud)
端口80和443只是默认端口号。