|
Post by mikeukmid on Oct 12, 2007 7:25:45 GMT -5
For people with dynamic IP, a cheap and cheerful way to find your current IP address. (At least until Carl shows it up on the RB console!) call cssStyles div main url$="http://yoip.com.ua/en/" print "Click "; link #getIP,"here",[doitNow] print " to get current external IP address" end div wait
[doitNow] r$=httpget$(url$) gosub [findIP] wait
[findIP] indx=instr(r$,">Your IP is") r$=mid$(r$,indx+12,20) indx=instr(r$,"<") IP$=left$(r$,indx-1) titlebar "Your current external IP address" 'added 12th Oct div response print print "Your current IP address is:" html " <br> " html "<font size=24>" print IP$ html "</font>" html " <br> " end div div wayout print "[ "; link #exit, "Exit",[quit] print " ]" end div return
[quit] cls end
sub cssStyles cssid #main, "{font-size:16pt;text-align:center;background-color:lightgreen;}" cssid #response, "{text-align:center; font-family:arial;color:blue;font-size:24pt; background-color:yellow;}" cssid #wayout, "{font-size:14pt;text-align:center;background-color:lightgreen;}" end sub
|
|
|
Post by Alyce on Oct 12, 2007 8:45:16 GMT -5
That rocks! Thanks, Mike.
|
|
|
Post by carlgundel on Oct 12, 2007 11:29:11 GMT -5
Very handy. :-)
|
|
|
Post by carlgundel on Oct 12, 2007 12:51:54 GMT -5
Now that I think about it, I don't think it's going to be a problem to get the local network address, but short of doing what your example does I'm not sure how to get the WAN IP address programmatically. I suppose I could just add a button that fetches the WAN IP address like your program does and display it.
-Carl
|
|
|
Post by mikeukmid on Oct 12, 2007 14:14:09 GMT -5
I dont think it is possible to get the external IP programmatically other than in that way. All my searches indicate that the IP can only be obtained from a server, the originating IP being identified to the server. The RBserver could identify the IP in cases where users can access their server externally, but in my case I can only access from an internal IP. Connecting externally seems to be blocked by something I do not understand - double NATing! Logging in to the router to find the IP is a bit of a pain so I think I will stick with the RB method. Ok as long as the url remains active. Mike. Edit... Even cheaper and "cheerfuller", just bookmark the following url www.networksecuritytoolkit.org/nst/cgi-bin/ip.cgiOh well it was fun while it lasted ;D Edit again... No, why did I say that, this IS a useful RB application Version 2: call cssStyles div main url$="http://www.networksecuritytoolkit.org/nst/cgi-bin/ip.cgi" print "Click "; link #getIP,"here",[doitNow] print " to get current external IP address" end div wait
[doitNow] r$=httpget$(url$) gosub [findIP] wait
[findIP] titlebar "Your current external IP" div response print print "Your current IP address is:" html " <br> " html "<font size=24>" print r$ html "</font>" html " <br> " end div div wayout print "[ "; link #exit, "Exit",[quit] print " ]" end div return
[quit] cls end
sub cssStyles cssid #main, "{font-size:16pt;text-align:center;background-color:lightgreen;}" cssid #response, "{text-align:center; font-family:arial;color:blue;font-size:24pt; background-color:yellow;}" cssid #wayout, "{font-size:14pt;text-align:center;background-color:lightgreen;}" end sub
|
|