我使用Apache的HttpClient通過httpclient-fluent-builder下載http頁面。不能用HttpClient下載不同的服務器端口
這是代碼:
...
try {
response = Http.get("http://fr3.ah.fm:9000/played.html")
.use(client) // use this HttpClient (required)
.charset("windows-1252") // set the encoding... (optional)
.asString();
} catch (IOException e) {
Log.d(TAG, "Error: "+e.toString());
e.printStackTrace();
}
Log.i(TAG, ""+ response);
...
問題是,我得到org.apache.http.client.ClientProtocolException
這件事情與主機:端口/ URL,東陽它的URL不工作端口。我還得到了另一個Httphelper類與流利構建器相同的錯誤。防火牆關閉。
的logcat:http://pastebin.com/yMMvvdQ3
如果您在瀏覽器中點擊http://fr3.ah.fm:9000/played.html,它會給你一些有效的東西? – 2010-08-18 22:46:14
是的,我試着從我的常規瀏覽器和模擬器內的Android瀏覽器。 – droidgren 2010-08-18 23:21:40