我有以下代码:
JSONObject jsonRequest = new JSONObject();
jsonRequest.put("id", 1);
jsonRequest.put("method", "mymethod");
entity = new JSONEntity(jsonRequest);
HttpPost request = new HttpPost("http://192.168.1.103/foo/bar.php");
request.setEntity(entity);
HttpResponse response = httpClient.execute(request);
不相关的代码被删除
它发送到.php页面。在.php页面上,我调用var_dump
来检查$_POST和$_GET的内容。
任何想法?
解决了。在php中获取数据:
$input = file_get_contents('php://input');