I try to use the get method to extract data  in the following codes.
It works for all other pages except for the link shown in the code.
The same link works fine also in all browsers.
Could you please give me some suggestions to solve the problem?

      HttpClient client = new HttpClient();
        client.getParams().setCookiePolicy(
CookiePolicy.BROWSER_COMPATIBILITY);
        try {
          GetMethod get = new GetMethod("
http://academic.live.com/query.aspx?q=test&count=3";);

          //Create an instance of HttpClient.
          get.setFollowRedirects(true);
          get.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY
);
          int iGetResultCode = client.executeMethod(get);

          if (iGetResultCode != HttpStatus.SC_OK) {
            System.err.println("Method failed: " + get.getStatusLine());
          }
          byte[] getResponseBody = get.getResponseBody();
          String strGetResponseBody = new String(getResponseBody,
"ISO-8859-1");
          System.out.println("body:"+strGetResponseBody);
          get.releaseConnection();
        }
        catch (HttpException e) {
          System.err.println("Fatal protocol violation: " + e.getMessage());
          e.printStackTrace();
        }
        catch (IOException e) {
          System.err.println("Fatal transport error: " + e.getMessage());
          e.printStackTrace();
        }
        catch (Exception e) {
          e.printStackTrace();
        }

thanks,
Ahmet Topcu

Reply via email to