405 Not Allowed nginx/0.7.67-mybk
android开发中遇见405NotAllowednginx/0.7.67错误:错误原因:使用post方式请求静态页面
处理方式:改用get方式请求
部分代码如下:
Stringurl="http://m.weather.com.cn/data/101010100.html";
//HttpPostrequest=newHttpPost(url);//post方式请求出错,如图一
HttpGetrequest=newHttpGet(url);//正常,如图二
HttpResponsehttpResponse;
StringretSrc=null;
try{
httpResponse=newDefaultHttpClient().execute(request);
retSrc=EntityUtils.toString(httpResponse.getEntity());
JSONObjectresult=newJSONObject(retSrc);
returnparseInfo(result);
}catch(Exceptione){
return"出错了"+e.getMessage()+""+retSrc;
}
页:
[1]