I am getting 503 Exception

Post your questions about IP address geolocation here.
Locked
tharuntej
New Member
Posts: 1
Joined: Sat Aug 24, 2013 9:36 am

I am getting 503 Exception

Post by tharuntej » Sat Aug 24, 2013 9:44 am

Hi
I am trying to extract the data of few Ip addresses.
It worked for sometime and currently. The following is the code.

Code: Select all

import java.net.*;
import java.io.*;

public class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL oracle = new URL("http://whatismyipaddress.com/ip/50.156.54.247");
        URLConnection yc = oracle.openConnection();
        BufferedReader in = new BufferedReader(new InputStreamReader(
                                    yc.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null) 
            System.out.println(inputLine);
        in.close();
    }
}
I am getting this exception..

T
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 503 for URL: http://whatismyipaddress.com/ip/50.156.54.247
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
at com.tharun.example.URLConnectionReader.main(URLConnectionReader.java:11)
Any one please help me.

Thank you.

User avatar
Chrispcritters
Forum Administrator
Posts: 2461
Joined: Tue Mar 02, 2010 5:41 pm
Location: 127.0.0.1 | ::1
Contact:

Re: I am getting 503 Exception

Post by Chrispcritters » Sat Aug 24, 2013 10:31 am

Basically, we don't allow you to do that. A "few" is defined as 2 or 3. For our rate limiting to kick you've gone well beyond that.

Please see the website terms of use and our API usage page.
Founder & CEO of WhatIsMyIPAddress.com.
You can follow me on Twitter and Facebook for some behind the scenes info.

Voodoo
Active Member
Posts: 572
Joined: Fri Mar 11, 2011 10:17 am

Re: I am getting 503 Exception

Post by Voodoo » Wed Aug 28, 2013 6:42 am

If you use Socket and input/outputStream you'd be able to read everything. URLConnection is used only by casual "programmers" ;)
Example:

Code: Select all

                ...
                Socket soc = new Socket("WhatismyIPAddress.com", 80);                
                OutputStream out = soc.getOutputStream();
                // don't modify this string
                out.write(("GET /ip/50.156.54.247 HTTP/1.1\r\n"+
                                "Host: WhatismyIPAddress.com\r\n"+
                                "User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0\r\n"+
                                "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"+
                                "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n"+
                                "Accept-Encoding: gzip,deflate,sdch\r\n"+
                                "Accept-Language: en-us,en;q=0.5\r\n"+
                                "Connection: close\r\n\r\n").getBytes());
                InputStream is = soc.getInputStream( );
                ...

Locked

Who is online

Users browsing this forum: No registered users and 0 guests