开发者

JSONRPC on Android does not POST

I have the following code:

JSONObject jsonRequest = new JSONObject();
jsonRequest.put("id", 1);
jsonRequest.put("method", "mymethod");
entity = new JSONEntity(jsonReq开发者_Python百科uest);
HttpPost request = new HttpPost("http://192.168.1.103/foo/bar.php");
request.setEntity(entity);
HttpResponse response = httpClient.execute(request);

Irrelevant code removed

It posts to a .php page. On the .php page I call var_dump to check the content of both $_POST and $_GET. Both are empty.

Any idea?


Solved it. Obtain the data in php:

$input = file_get_contents('php://input');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜