문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top