我使用下面的代码从html获取数据并使用它。
public static String getXML(String Link){
//String sentence = "";
String line = null;
Log.d("getxml","get");
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(Link);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
line = EntityUtils.toString(httpEntity);
} catch (UnsupportedEncodingException e) {
line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
} catch (MalformedURLException e) {
line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
} catch (IOException e) {
line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
}
return line;
}
但对于一个网站,它不起作用
对于Link ="http://www.perspolis-club.com/?start=12&format=feed&type=rss"
我的函数刚刚返回'<script> setTimeout(location.reload(true), 1000); </script>'
Question:
如何从上面的链接获取正确的数据。