0
我送一个JSON数组服务器:PHP - 接收JSON(POST)
{
"Name":"Number",
"Name":"Number"
, ...
}
我怎样才能得到它的PHP?
发送方法是POST。
这里是我的Android代码:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://192.168.1.7/admina/contacts_inout.php");
String json = "";
json = jsons.toString();
StringEntity se = new StringEntity(json);
httpPost.setEntity(se);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
HttpResponse httpResponse = httpclient.execute(httpPost);
您可以使用[php:// input](http://php.net/manual/en/wrappers.php.php#wrappers.php.input)阅读原始文章(因为您没有发布表单字段) )。一个简单的使用/例子是'if(getenv('REQUEST_METHOD')=='POST'){$ data = file_get_contents(“php:// input”); }' –
@KraangPrime你的意思是:file_get_contents(“php:// input”); ? – Ghorbanzadeh
是的。请阅读我最后一次声明的编辑(和上次修改时间) –