Here is how you set it in Java. Of course, there is a lot more code involved such as try/catch blocks and stuff.
String referer = "http://spider.desertrealm.com"; String user_agent = "DesertRealm.com; 0.2; [J];"; URL hp = new URL(currentURL); URLConnection hpCon = hp.openConnection(); HttpURLConnection uc = (HttpURLConnection)hpCon; hpCon.setRequestProperty ("Referer", referer); hpCon.setRequestProperty ("User-Agent", user_agent); Thanks, Brian -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 1:58 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [Robots] Re: SV: matching and "User-Agent:" in robots.txt On Thursday, March 14, 2002, at 10:59 , Thomas Huber wrote: > > > How can the UA be set in Java? > >> Create a user-agent object thus: >> >> "$ua = LWP::RobotUA->new('Banjo/1.1','http://nowhere.int/banjo.html >> [EMAIL PROTECTED]') There is no explicit setUserAgent call. However, you can set the header itself. I forget the exact call, but it's something like urlConnection.setHeader("User-Agent", "Banjo/1.1"). If you want to set the From header you'll have to use this method too. -- Mike -- This message was sent by the Internet robots and spiders discussion list ([EMAIL PROTECTED]). For list server commands, send "help" in the body of a message to "[EMAIL PROTECTED]". -- This message was sent by the Internet robots and spiders discussion list ([EMAIL PROTECTED]). For list server commands, send "help" in the body of a message to "[EMAIL PROTECTED]".