我正在开发一个Android应用程序,通过新的HttpPost(url)向服务器发送数据(托管在hostinger.es中 - 免费测试应用程序); howevere,当我在我的手机上运行应用程序,我总是在我的日志如下回答:Android httpPost(URL) - > 403 Forbidden
09-03 15:24:40.916: response:
<html>
<head>
<title>Error 403 - Forbidden</title>
<meta http-equiv="Refresh" content="0;url=http://www.hostinger.co/error_404?" />
</head>
<body>
</body>
</html>
我的服务器代码的PHP/MySQL。我已经更改了我的文件夹和文件.php的FileZilla中的权限,但仍然得到相同的答案。
我的客户的规范要求:
private static final String url = "http://yyy.esy.es/XXXX/process.php/senddata/";
// yyy subdomain in hostinger
// XXXX the folder where my php files are
protected void sendDataToServer(final TestData data) {
ArrayList<NameValuePair> keyValuePairs = new ArrayList<NameValuePair>();
keyValuePairs.add(new KeyValuePair(Constant.FB_ID, data.getId()));
....
ResponseHandler<String> res = new BasicResponseHandler();
HttpPost postMethod = new HttpPost(url);
// Data that is to be sent
postMethod.setEntity(new UrlEncodedFormEntity(keyValuePairs));
// Execute HTTP Post Request
String response = httpClient.execute(postMethod, res);
有人能帮助我吗?
在此先感谢
嗨,如果你真的想得到很好的答案,请展示te帖子的代码。你希望人们如何帮助你? – 2014-09-03 20:56:29
完成!我刚刚添加了一些代码 – 2014-09-03 21:08:53
使用Chrome浏览器开发人员工具,尝试在该URL上执行POST。是否也有错误? – alpinescrambler 2014-09-03 22:16:23