I have seen these in our users logs as well. I wasn't sure if it was twitter or a mobile gateway they were using.

On Oct 29, 2009, at 11:41 AM, hima wrote:


Hi
I am trying to collect users data from twitter, like the number of
followers, number of tweets, the time the user' account is alive and
similar statistics. I have done this before in august and got
appropriate results with my code.I ran the code again a week ago and
it worked and gave me results. The same code however, stopped working
since a week now responding with a 502 bad gateway error. I am not
able to connect to the twitter page and get the xml body. This is my
function to return the xml page:

public static String webget(String host, String doc, String username,
String password)
        {
                String body = "";
                byte[] auth = Base64.decode(username + ":" + password );
                String header = "Get " + doc + " HTTP/1.0\r\n";
                header += "Authorization: Basic " + auth ;
                header += "Accept: application/xml, text/plain, text/xml, 
text/*\r
\n";
                header += "\r\n";

                try
                {
                        Socket sock = new Socket(host, 80);
                        OutputStreamWriter os = new 
OutputStreamWriter(sock.getOutputStream
());
                        os.write(header);
                        os.flush();
                        sock.getOutputStream().flush();

                        BufferedReader br = new BufferedReader(new
                       InputStreamReader(sock.getInputStream()));
                        String str = null;
                        while ( (str = br.readLine()) != null)
                        {
                                body += str + "\n";
                        }
                        sock.close();
                }
                catch(IOException ioe)
                {
                        return "";
                }

                return body;
        }


This function is called like this:

webget("twitter.com", "/users/show/"+UserId+".xml", USERNAME,
PASSWORD)


I have not made any changes to the code since august. I am guessing
there have been changes in the twitter API which is giving me this
error.However, nothing like this is mentioned in the forums. Can you
let me know if there are changes in the twitter API that is causing
this?

Thanks
Hima

Reply via email to