Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误HTTP/1.0 405方法不允许_Android_Http Status Code 405 - Fatal编程技术网

Android 错误HTTP/1.0 405方法不允许

Android 错误HTTP/1.0 405方法不允许,android,http-status-code-405,Android,Http Status Code 405,我想建立一个Htttp连接这是我的代码 try { HttpClient client = new DefaultHttpClient(); HttpPost httpMethod = new HttpPost("http://www.google.co.in/"); String requestBody = "some text"; HttpMethod.setEntity(new StringEntity(requestBody)); HttpResponse response = clie

我想建立一个Htttp连接这是我的代码

try
{
HttpClient client = new DefaultHttpClient();
HttpPost httpMethod = new HttpPost("http://www.google.co.in/");
String requestBody = "some text";
HttpMethod.setEntity(new StringEntity(requestBody));
HttpResponse response = client.execute(httpMethod);
textView.setText(response.getStatusLine().toString());
}
但是我无法获得“HTTP/1.0 405方法不允许”错误
我将非常感谢您的帮助

也许您应该尝试使用接受POST请求的服务器。你的代码可能没什么问题,谷歌的头版根本就没有帖子


我能想到的一个服务器的简单例子是。我相信他们不会介意。

这意味着请求的URL不接受POST方法。使用GET重试。

Yep,使用
HttpGet
类并使用
setParams
方法。