0

我正在尝试从 HTML 表中获取数据,但是当我连接到网站时,它没有返回它在浏览器中显示的内容。

这是我通过查看 html 结果期望得到的:

<div id="ResultsContainer">
    <div id="Pagination"><div class="left">displaying: 601 - 633 of 633</div><div class="right">
... 

这就是我得到的:

 <div id=ResultsContainer>
        <p class=RedBold10pt>Search returned no matches</p>
 </div>

这是我的 Java 代码

HttpClient client = new DefaultHttpClient();

HttpGet request = new HttpGet();
request.setHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.15 Safari/536.5");
request.setURI(new URI("http://results.active.com/pages/searchform.jsp?posted_p=t&numPerPage=50&page=0&rsID=10505&queryType=division#VIEW"));
HttpResponse response = client.execute(request);

BufferedReader in = null;
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");

while ((line = in.readLine()) != null) {
    sb.append(line + NL);
}
in.close();
String page = sb.toString();
System.out.println(page);

这可能是什么原因?

4

1 回答 1

0

问题出在 Google AppEngine 上。我不得不从 1.6.4 降级到 1.6.3

于 2012-04-09T21:30:01.897 回答