Android发送成功但php无法接收任何内容

时间:2018-02-25 20:48:58

标签: java php android http post

当我在Android中执行此操作时

client.post("http://10.0.2.2/cubsfit/cubsfit_sync/insertuser.php", params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(String response) {


                Log.d(TAG, "Success" + response);
            }

            @Override
            public void onFailure(int statusCode, Throwable error, String content) {

            }
        });

我得到了日志

D/ContentValues: SuccesssleepJSON=%5B%7B%22wakeuptime%22%3A%222018-02-23+10%3A30%22%2C%22sleeptime%22%3A%222018-02-23+10%3A25%22%2C%22id%22%3A%221%22%2C%22babyid%22%3A%22100%22%7D%2C%7B%22wakeuptime%22%3A%222018-02-23+12%3A35%22%2C%22sleeptime%22%3A%222018-02-23+12%3A30%22%2C%22id%22%3A%222%22%2C%22babyid%22%3A%22100%22%7D%5D<br />
             <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
             <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: HTTP_RAW_POST_DATA in D:\wamp64\www\cubsfit\cubsfit_sync\insertuser.php on line <i>5</i></th></tr>
             <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
             <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
             <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0003</td><td bgcolor='#eeeeec' align='right'>246392</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='D:\wamp64\www\cubsfit\cubsfit_sync\insertuser.php' bgcolor='#eeeeec'>...\insertuser.php<b>:</b>0</td></tr>
             </table></font>
             []

在php方面,当我做

$raw_post = file_get_contents('php://input');
print_r($raw_post);
print_r($GLOBALS["HTTP_RAW_POST_DATA"]);

我刚刚

<br />
<font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: HTTP_RAW_POST_DATA in D:\wamp64\www\cubsfit\cubsfit_sync\insertuser.php on line <i>5</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0003</td><td bgcolor='#eeeeec' align='right'>244376</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='D:\wamp64\www\cubsfit\cubsfit_sync\insertuser.php' bgcolor='#eeeeec'>...\insertuser.php<b>:</b>0</td></tr>
</table></font>

问题是为什么我不能在我的PHP

中得到这个
sleepJSON=%5B%7B%22wakeuptime%22%3A%222018-02-23+10%3A30%22%2C%22sleeptime%22%3A%222018-02-23+10%3A25%22%2C%22id%22%3A%221%22%2C%22babyid%22%3A%22100%22%7D%2C%7B%22wakeuptime%22%3A%222018-02-23+12%3A35%22%2C%22sleeptime%22%3A%222018-02-23+12%3A30%22%2C%22id%22%3A%222%22%2C%22babyid%22%3A%22100%22%7D%5D    

0 个答案:

没有答案