Monday, July 13, 2009

Problem reading Google RSS from Java

I dont know why the google makes it a problem. But when you try to access a RSS feed posted by google from java application it gives the following error.

java.io.IOException: Server returned HTTP response code: 403 for URL:

Here im using Rome to read the RSS feeds made by a google group. Here other than passing the url to XmlReader, im passing a URLConnection. But the difference is, here im faking this request as a request made by a Mozilla browser, by setting up the User-agent property.

urlConn.setRequestProperty("User-agent","Mozilla/2.0.0.11");
reader = new XmlReader(urlConn);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(reader); 

And i guess you cant make more than 1000 requests for the google per day. So dont make any applications which exceed that limit.

Enjoy !!

3 comments:

Mufthas Rasikim said...
This comment has been removed by the author.
Chanaka Rupasinghe said...

Thank you machan.
This is really valuable for us

Mufthas Rasikim said...

thanx...