我想通过Android中的post方法发送数据。但我怎么能在服务器上接收数据。我的服务器是在PHP中。我在php $ _post []中找到了一个方法。我如何使用它? 我的客户代码是php中的post方法
client=new DefaultHttpClient();
HttpPost request=new HttpPost("http://10.0.2.2/php_server/index.php");
HttpEntity entity;
try
{
StringEntity string=new StringEntity("I am android");
entity=string;
request.setEntity(entity);
HttpResponse response=client.execute(request);
}
catch(Exception e)
{
Log.e("socket connection", e.toString());
}
顺便说一句,'$ _post []'不是一种方法......它是一个数组。 – Cristian 2011-05-30 13:22:30
@克里斯蒂安,很好的通知! ''''''是一个运算符,就像在'Java' – Nemoden 2011-05-30 15:01:18