一個很正常的網站,使用httpclient提交怎么都會有問題
HttpPost httppost = new HttpPost(); // HttpGet httppost = new HttpGet(); URI uri = new URI(post); httppost.setURI(uri); HttpClient httpclient = new DefaultHttpClient(); String html = ""; HttpResponse response = httpclient.execute(httppost); System.out.println(response.getStatusLine());
總是報那個錯誤org.apache.http.NoHttpResponseException:
The target server failed to respond
本來打算讀讀源碼看看到底什么問題,突然想把post換成get方式再試試,結果完全無問題了。。。。哪位有興趣讀了源碼可以告訴我下原因