This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Imitating a specific browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Imitating a specific browser" Watch "Imitating a specific browser" New topic

Imitating a specific browser

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
Hi there,

If I want to connect to a particular website, I'll often use the URL class and it's openStream() method. However, on occasion, I can't connect to the web server this way as they probably have in place some sort of device to prevent the scanning from unknown sources. I can navigate fine to the same website using the exact same URL in my IE browser no problem. So I'm thinking that a browser must be identifying itself to the server somehow in the HTTPRequest object sent to the server. That being the case, how does one imitate the source request as having come from IE or some other browser? Is there a property I can set on some other class before I call the URL.openStream() method?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
Use the HtmlUnit library - it can imitate various browsers, and does a very good job of programmatic web access.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Imitating a specific browser
It's not a secret anymore!