如何httpPost()隐蔽HTTPGET()? [英] How to httpPost() to covert httpGet()?
本文介绍了如何httpPost()隐蔽HTTPGET()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在这里httpPost()的Java类,
The httpPost() java class here,
public String getXmlFromUrl_NewRegistration(String url,
String username, String firstname, String lastname, String email,
String password) {
String json = null;
try {
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://aleedex.biz/game/users.php?action=new");
String postParameter = "username=" + username + "&firstname="
+ firstname + "&lastname=" + lastname + "&email=" + email
+ "&password=" + password;
try {
httpPost.setEntity(new StringEntity(postParameter));
} catch (Exception e) {
}
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
json = EntityUtils.toString(httpEntity);
} catch (UnsupportedEncodingException e) {
} catch (ClientProtocolException e) {
} catch (IOException e) {
json = null;
}
Log.d("json", json);
return json;
}
此外,在HTTPGET()使用相同的参数,如用户名,名字,姓氏,电子邮件,密码
如何通过HTTPGET注册用户()与链接相同的参数 http://aleedex.biz/game/users.php?action=new
推荐答案
我按照教程和解决我的问题的如何到Android用PHP连接,MySQL的
I have follow that Tutorial and solve my problem How to connect Android with PHP, MySQL
这篇关于如何httpPost()隐蔽HTTPGET()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文