POST数据不存在';无法发送到PHP脚本

POST数据不存在';无法发送到PHP脚本,php,android,Php,Android,我的应用程序尝试发送如下帖子数据: HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; HttpPost httppost = new HttpPost("http://localhost/mydir/"); try { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); na

我的应用程序尝试发送如下帖子数据:

HttpClient httpclient = new DefaultHttpClient();
HttpResponse response;
HttpPost httppost = new HttpPost("http://localhost/mydir/");

try {
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("sender_app", "My app"));
    nameValuePairs.add(new BasicNameValuePair("someString", "My string"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
    // TODO Auto-generated catch block
} catch (IOException e) {
    // TODO Auto-generated catch block
}       
ob_start();
var_dump($_REQUEST);
$request_dump = "_REQUEST: ".ob_get_clean();
file_put_contents("requests.log",$request_dump, FILE_APPEND | LOCK_EX);
_REQUEST: array(0) {
}
应用程序成功发出请求并将其记录,但
$\u请求
superglobal始终为空,并且未设置
sender\u应用程序
someString
post变量

$\u服务器[HTTP\u USER\u AGENT]
被报告为
Apache-HttpClient/UNAVAILABLE(java 1.4)
,所以至少发送了这个消息

日志如下所示:

HttpClient httpclient = new DefaultHttpClient();
HttpResponse response;
HttpPost httppost = new HttpPost("http://localhost/mydir/");

try {
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("sender_app", "My app"));
    nameValuePairs.add(new BasicNameValuePair("someString", "My string"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
    // TODO Auto-generated catch block
} catch (IOException e) {
    // TODO Auto-generated catch block
}       
ob_start();
var_dump($_REQUEST);
$request_dump = "_REQUEST: ".ob_get_clean();
file_put_contents("requests.log",$request_dump, FILE_APPEND | LOCK_EX);
_REQUEST: array(0) {
}

有什么问题吗?

我不明白为什么
$\u请求总是空的,但是当您记录的字符串是
变量转储($\u请求)的结果时,“它被记录下来”。你能从日志中粘贴一个例子吗?我已经更新了问题,以显示请求后日志的外观。已收到请求,但未设置任何变量。此时,我唯一的建议是检查$\u POST superglobal。是什么让您的$\u服务器['request\u METHOD']可用?那么这可能会有一些帮助: