开发者

PHP - Get Gateway/Router IP, UPnP

I am attempting to create a UPnP method on an internal PHP server if at all possible. I need it to be mostly platform independent so that it may run on Windows, OSX, or Linux.

I believe I can get my SOAP protocols working for UPnP, but first I must determine the IP address of the gateway/router that the server goes through. Is it possible to retrieve this information with PHP? If not, what about Python or 开发者_运维技巧Ruby?

I have done this in C# but am looking for a more platform independent method now.

Thanks!

CLARIFICATION: I am looking for the internal IP address of the gateway, not the external IP.


You could retrieve it using external services such as whatismyip.com and similar (via cURL).

another option: since most routers allow for telnet connection or have web admin interface, you could login using PHP and just scrape the external IP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜