aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes java maskeraiding as firefox - how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java maskeraiding as firefox - how?" Watch "java maskeraiding as firefox - how?" New topic

java maskeraiding as firefox - how?

chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
this is a tough one, but there's got to be a way to do it. my program accesses urls, but when it tries google, google says
because google doesn't like automated searches, it only wants browsers to visit google, not java programs.
the way it does this most likely is with the php variable $_SERVER['HTTP_USER_AGENT']
it tests for the browser type, and if its not one of the major browsers, it returns a 403.
i need my java program to know when it is given this request, and i need to learn how to send back any string i want, because then i can tell google that java is firefox, when its not.

sorry about the spacing, it gave me an error telling me not to use abbreviations
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61973

So you want us to help you cheat?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
uc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)"); // Will set IE user agent
got it, this may also be the solution to my previous post

i love cheating lol
Rob Spoor

Joined: Oct 27, 2005
Posts: 19847

I believe that HttpClient would have also allowed you to do this.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: java maskeraiding as firefox - how?