Get External IP-address

Difference between version 2 and 3 - Previous - Next
Created by [CecilWesterhof].

Often you want to know your external IP-address. For this I created the following proc:

======
proc getExternalIP {} {
    set             token [http::geturl http://myexternalip.com/raw]    set             externalIP [string trim [http::data ${token}]]
    ::http::cleanup ${token}
    return          ${externalIP}
}
======

It depends on:

======
package require http
======

And it expects that http://myexternalip.com/raw returns your external IP-address.

----

As always: comments, tips and questions are appreciated.


** See also **

   * [how to find my own IP address]

<<categories>>Internet | Utilities