Results 1 to 3 of 3
  1. #1
    MrFish is offline Member
    Join Date
    Jan 2010
    Posts
    43
    Rep Power
    0

    Default Is it possible to set the User Agent?

    I need to make an http connection to a webpage and get it's contents. Using Java I've noticed when trying to access the base www directory it sends me to the 'm' (mobile) directory automatically so I do not get the content I was looking for. Is it possible to set a fake user agent or to bypass this some other way?

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,227
    Rep Power
    6

    Default

    Java Code:
    URL url = new URL(...);
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    //conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)");
    conn.connect();

  3. #3
    MrFish is offline Member
    Join Date
    Jan 2010
    Posts
    43
    Rep Power
    0

Similar Threads

  1. MS Agent
    By D-Technodude in forum New To Java
    Replies: 1
    Last Post: 03-19-2011, 05:03 AM
  2. Lotus Notes Java Agent Exception
    By BO2LA in forum Java Applets
    Replies: 1
    Last Post: 10-21-2010, 11:33 AM
  3. The Tiny Multi Agent Platform 4.0
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 03-14-2008, 06:10 PM
  4. The Tiny Multi Agent Platform 2.0
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-21-2007, 07:56 PM
  5. Project agent
    By Peter in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 06:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •