我的json代码适用于其他网络服务,但我的代码不适用于此网站。 http://api.twitch.tv/kraken/streams?limit=30&offset=0&game=League+of+Legends&on_site=1
我从http://www.twitch.tv/directory/game/League%20of%20Legends获得此网络服务。 我用FireBug检查了这个来源,用200来确定。这个网络服务有什么问题?
编辑:我的帖子方法代码:
if (method == "POST") {
HttpParams httpParameters = new BasicHttpParams();
int timeout1 = time;
int timeout2 = time;
HttpConnectionParams.setConnectionTimeout(httpParameters,
timeout1);
HttpConnectionParams.setSoTimeout(httpParameters, timeout2);
try {
DefaultHttpClient httpClient = new DefaultHttpClient(
httpParameters);
httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse httpResponse = httpClient.execute(httpPost);
StatusLine statusLine= httpResponse.getStatusLine();
HttpEntity httpEntity = httpResponse.getEntity();
statusCode = statusLine.getStatusCode();
System.out.println("#######"+statusCode);
if(statusCode!=200){
setError(ERRORS.UNKNOWN);
System.out.println("UNKNOWN error");
}
veri = httpEntity.getContent();
} catch (final java.net.SocketTimeoutException e) {
setError(ERRORS.TIME_OUT);
System.out.println("TIME_OUT error");
} catch (final java.net.UnknownHostException e) {
setError(ERRORS.UNKNOWN_HOST);
System.out.println("UNKNOWN_HOST error");
} catch (final java.net.UnknownServiceException e) {
setError(ERRORS.UNKNOWNSERVICE);
System.out.println("UNKNOWN_SERVICE error");
} catch (final java.net.ConnectException e) {
setError(ERRORS.CONNECT);
System.out.println("CONNECT error");
} finally {
if (httpPost != null) {
// httpPost.abort();
System.out.println("HttpPost found: ");
}
}
}