我想通過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