// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.net.*;
import java.io.*;

public class ExternIP {
   public static void main(String[] args) {
      try {
         URL url = new URL("http://www.xxxx.dk:8080/test/ip.jsp");
         HttpURLConnection con = (HttpURLConnection)url.openConnection();
         con.connect();
         if(con.getResponseCode() == HttpURLConnection.HTTP_OK) {
            BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String ip = br.readLine();
         System.out.println(ip);
            br.close();
         }
         con.disconnect();
      } catch (MalformedURLException e) {
         e.printStackTrace();
      } catch (FileNotFoundException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
   }
}
