Results 1 to 4 of 4
  1. #1
    angeles86 is offline Member
    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    Default How to download protected web page using JAVA

    We have a task, to design a class which can download source of any web page. But when I try to test my code and fetch page like http://anidb.net/perl-bin/animedb.pl?show=main nothing is working.
    Standard code like this fails:

    Java Code:
    import java.net.*;
    import java.io.*;
    
    public class URLReader {
        public static void main(String[] args) throws Exception {
            URL link = new URL("http://www.anidb.net/");
            BufferedReader in = new BufferedReader(
            new InputStreamReader(link.openStream()));
    
            String inputLine;
            while ((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();
        }
    }
    Here is the result I got: wq>"5U=?k}~bd`?lz>"?j׉Ry}K\ c_DL٪_ Mm__0C_asS >dC0s_yA%A@,4xɃ?
    I have tried everything: cookies, header files but nothing seems to work. If you have some hint for me, I will appreciate it. Ive been thinking about this problem for to weeks. Thanks.

  2. #2
    angeles86 is offline Member
    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    Default Re: How to download protected web page using JAVA

    It's all about gzip. I should use java.util.zip.GZIPInputStream.
    Kind people helped me.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: How to download protected web page using JAVA

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: How to download protected web page using JAVA

    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 17
    Last Post: 05-22-2012, 01:19 PM
  2. Please help with Pasword protected page Java script..!
    By boyfrom75 in forum Forum Lobby
    Replies: 3
    Last Post: 11-15-2011, 08:13 PM
  3. Download then show page from jsp
    By aflores in forum New To Java
    Replies: 4
    Last Post: 09-10-2010, 09:26 AM
  4. how direct her/ him to the Suns download page?
    By willemjav in forum Java Applets
    Replies: 1
    Last Post: 04-17-2008, 04:03 PM

Tags for this Thread

Posting Permissions

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