""Yogi_Bear _79" <IT*****@spamfr ee.com>" wrote in comp.lang.java:
I've been searching for a way to programtically get my public IP from my
router. After much research th eonly thing I came up with was going to a
site like privacy.net and returning the value it reads. What I'd like
to do is compile this into my .chm I give my remote users. So ideally
they would have a button to press that goes to the web site reads the
site and returns the ip to a text box.
I'd like to do it without the user actually seeing IE open the web site.
Any leads?
For starters, don't use IE. Opera and Mozilla are both excellent
alternatives that include many useful features without all the security risks
(have you noticed how many security updates Microsoft has released for
Internet Explorer over the years?).
I'll assume you're writing Java code (otherwise why else would you post
your question here?), and that your .CHM has a Java Applet embedded or is
causing a Java Application or Java Servlet to start which returns the IP as a
result.
The easy way to read a web page is to use the Java HTTP Component, for
which some simple documentation can be found here:
Java HTTP Component
http://www.jscape.com/inetfactory/http.html
For more information about HTTP (which I assume you don't need, but
perhaps other readers may find it helpful), visit this web page:
CGI tutor
http://www.mindprod.com/projects/cgitutor.html
--
Randolf Richardson, pro-active spam fighter -
rr@8x.ca
Vancouver, British Columbia, Canada
Sending eMail to other SMTP servers is a privilege.