且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从Windows winsock客户端连接到PHP服务器?

更新时间:2022-04-24 21:20:43

address = ' 如何获取此IP?'; // 位于www.test.com/test/phpserver.php
address = 'how to get this ip?';//at "www.test.com/test/phpserver.php"


port =什么端口?
...
port = what port ?; ...





感谢您的时间:)



Thank you for your time :)


简答题使用卷曲库



长期回答阅读下面:



我认为你的php服务器将运行到默认端口80或8080.如果不是你可以检查httpd.conf文件中的端口号。如果它是windows,那么你可以使用

Short answer use curl library

For Long answer read below :

I think ur php server will be running to default port 80 or 8080. If not u can check port number in httpd.conf file. If it is windows then u can use
On a newer version of WAMP, click the WAMP server icon > Apache > httpd.conf





对于ip如果机器相同则使用127.0.0.1,如果它是不同的服务器则运行ipconfig或你的php服务器机器的命令提示符(或终端)上的ifconfig命令。尝试首先从您想要放置ur exe的机器ping该ip。它必须ping,否则检查防病毒或可能是一些防火墙后面的内部IP。现在你得到了ip&端口,所以现在你可以尝试连接。这是非常低级别的连接。如果您的服务器以标记语言提供数据,那么您必须解析它。



For ip if machine is same then use 127.0.0.1, if it is different server then run "ipconfig" or "ifconfig" command on command prompt (or terminal) of ur php server machine. Try pinging that ip first from the machine where u want to put ur exe. It must ping otherwise check antivirus or may be that is internal ip behind some firewall. Now u got ip & port so now u can try to connect. This is very low level connection. If your server gives data in markup language then u have to parse that.