Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top