5 Replies Latest reply: Mar 17, 2013 5:56 PM by EJP RSS

    URL reading difficulties

    997263
      Dear Oracle forum,

      I am new to this place and I turn to you regarding a question. At the moment I am programming in java a programme which reads a website. This website has has several pages namely:
      http://www.blabla.com/full-list.html?action=0&filter=C
      http://www.blabla.com/full-list.html?action=1&filter=C
      http://www.blabla.com/full-list.html?action=2&filter=C

      I would like to read each page in java. For this, I used thefollowing code:

      URL EP= new URL("http://www.blabla.com/full-list.html?action=0&filter=C");
      BufferedReader in = new BufferedReader(new InputStreamReader(EP.openStream()));

      No problems so far. However, the minute I change action=0 to action=1, java still returns to me the action=0. However, when I change filter=C to filter=A, the software returns the correct data.

      Would you be able to help me identify the problem here? Is there something wrong with the string?
        • 1. Re: URL reading difficulties
          EJP
          The minute you change it how?
          • 2. Re: URL reading difficulties
            997263
            The website I am dealing with contains names by alphabet (filter=Alphabet). These names are put in sets of ten on a page (each page having a specific number). For instance:
            Abba, Ado, Albert, Alfred, Alva, Alma, Arba, Arnold, Astrid, Atri (on page 1 of A thus full-list.html?action=0&filter=A)
            Avil, Awo, Ayaan, Ayil, Axel, Azo, Azi, Aziel (on page 2 of A thus full-list.html?action=1&filter=A)
            Bart, etc. (on page 1 of B thus full-list.html?action=0&filter=B)
            etc.

            I use:

            URL EP= new URL("http://www.blabla.com/full-list.html?action=0&filter=A"); (action=0)
            It returns nicely the page I want namely: http://www.blabla.com/full-list.html?action=0&filter=A (action=0)
            => Abba, Ado, Albert, Alfred, Alva, Alma, Arba, Arnold, Astrid, Atri

            However, when I use the code:
            URL EP= new URL("http://www.blabla.com/full-list.html?action=1&filter=A"); (action=1)
            It returns instead the information on the page: http://www.blabla.com/full-list.html?action=0&filter=A (action=0)
            => Abba, Ado, Albert, Alfred, Alva, Alma, Arba, Arnold, Astrid, Atri
            Whereas I need the information on action=1
            => Avil, Awo, Ayaan, Ayil, Axel, Azo, Azi, Aziel

            On the other hand when I change the filter from filter=A to filter=B in the URL. It works great It gives me back the information I want.
            • 3. Re: URL reading difficulties
              gimbal2
              You should ask the people who built the website why it is doing that. You're doing this with their approval right?
              • 4. Re: URL reading difficulties
                997263
                I asked the person running the website about it but he believed that the problem is with Java programming because if you put the links into the browser it works perfectly. Furthermore, he pointed out to me that it appears to be working with the "filter=A" and that the site should thus also accommodate this for "action=1". So at the moment I got the feeling that I am running in circles and my hope is vested in the community.
                • 5. Re: URL reading difficulties
                  EJP
                  Well my first response would be to ask whether you really executing the code you think you're executing? Clean build, then trace each URL as you retrieve it.