Solved

Appache httpClient cannot access news.google.com (500pts)

Posted on 2004-04-25
5
299 Views
Last Modified: 2011-09-20
I've been trying and trying to set up the apache httpClient (org.apache.commons.httpclient) to be able to read news.google.com. The page it fetches is the autogen-ed forbiden page:

"Google Error
Forbidden
Your client does not have permission to get URL / from this server."

Does anyone know what the exact problem is and how to configure httpClient to avoid this?

I first thought it wouldn't be too hard but it proved otherwise. In addition, it's also pretty urgent so 500pts.

Thanks!
0
Comment
Question by:il68
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10914443
0
 
LVL 10

Accepted Solution

by:
Mercantilum earned 500 total points
ID: 10915981
I guess if you try from a common browser (ie, mozilla...) it works...

If you have no pb with the common browser, it is the configuration of httpclient which is causing problem, e.g. header or cookie...

For instance, curl (http://curl.haxx.se/) retrieve data from a http server (and others) and returns the same error (forbidden) since some data that is given by common browsers is missing.

1 - ensure your httpclient is able to manage cookie
2 - ensure the header is correct

Apache: this link is appropriate: http://jakarta.apache.org/commons/httpclient/  for httpclient

You could as well look at the packets sent to google from the free http://www.ethereal.com/ network analyzer when you use a common browser ; it will give you an idea of what you have to send to google.
0
 

Author Comment

by:il68
ID: 10933641
Thanks, looking at a trace was a great idea - it didn't like the httpClient's user agent header.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10934570
Thanks - can I ask how you changed it finally?
0
 

Author Comment

by:il68
ID: 10954649
I haven't yet looked at what exactly it doesn't like - I was just trying it out with the fields that IE used to see which header was the problem.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now