routing - How to get external IP without relying on third party servers? -


is there way can retrieve external ip address without making connection outside network?

maybe asking router somehow?

does os know ip have if behind router?

all methods on stackoverflow recommend kind of third party provider, want application independent of other servers.

edit: best solution ive found yet this: http://code.google.com/p/csharp-upnp-portmapper/

which rely on upnp.

if router have webinterface, can fetch status page in webinterface of router, , parse ip-adress out of html.

php exemple telenor 4g router

<?php $url = "http://192.168.0.1/platform.cgi?page=home.htm"; $page = file_get_contents($url); preg_match("/ip address: [^0-9]+(?<ip>[0-9]+(\.[0-9]+){3})</", $page, $matches); $ip = $matches['ip']; echo $ip ?> 

as routers require username , passwords, proberly want use curl post thouse , fetch page after logged in.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -