开发者

problem in receiving data of post

I am facing problem to get data from post array in php. I used var_dump($_POST) for debugging. It shows 0{}. I am sending data from a android application.I am no开发者_JS百科t sure what is my problem. Is it related to content type? My content type is

<meta http-equiv="Content-Type" content=" text/html; charset=UTF-8">

My android code is

client=new DefaultHttpClient();
            HttpPost request=new HttpPost("http://10.0.2.2/php_server/index.php");
            List<NameValuePair>p=new ArrayList<NameValuePair>(1);
            p.add(new BasicNameValuePair("android","data received"));
            HttpEntity entity;

            try
            {   
                request.setEntity(new UrlEncodedFormEntity(p));
                HttpResponse response=client.execute(request);
            }
            catch(Exception e)
            {
                Log.e("socket connection", e.toString());
            }


Try to look at $HTTP_RAW_POST_DATA or try to get it by

<?php $postdata = file_get_contents("php://input"); ?> 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜