$ _POST Php boş

0 Cevap php

I have gone through all the responses in this post
print_r($_POST); ===> returns empty array
print_r($_SERVER);

Array ( [HTTP_HOST] => localhost 
        [HTTP_ACCEPT] => */* 
        **[HTTP__CONTENT_TYPE]** => application/json; charset=UTF-8" 
        [CONTENT_LENGTH] => 942
        **[CONTENT_TYPE]** => application/x-www-form-urlencoded 
        [PATH] => /usr/local/bin:/usr/bin:/bin 
        [SERVER_SIGNATURE] => Apache/2.2.14 (Ubuntu) Server at localhost Port 80
        [SERVER_SOFTWARE] => Apache/2.2.14 (Ubuntu) 
        [SERVER_NAME] => localhost 
        [SERVER_ADDR] => 127.0.0.1 
        [SERVER_PORT] => 80 
        [REMOTE_ADDR] => 127.0.0.1 
        [DOCUMENT_ROOT] => /var/www 
        [SERVER_ADMIN] => webmaster@localhost 
        [SCRIPT_FILENAME] => /var/www/slocation.php 
        [REMOTE_PORT] => 50657 
        [GATEWAY_INTERFACE] => CGI/1.1 
        [SERVER_PROTOCOL] => HTTP/1.1 
        [REQUEST_METHOD] => POST 
        [QUERY_STRING] => 
        [REQUEST_URI] => /slocation.php 
        [SCRIPT_NAME] => /slocation.php 
        [PHP_SELF] => /slocation.php 
        [REQUEST_TIME] => 1288466907 
    )

HTTP__CONTENT_TYPE ve CONTENT_TYPE arasındaki fark nedir?

print_r($HTTP_RAW_POST_DATA); ==> returns correct data posted
file_get_contents('php://input'); ======> returns correct data.

Sadece $ _POST başarısız olur.

Bu benim kıvırmak emirdir

$url = "http://localhost/slocation.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_HTTPHEADER, array('"Content-type: application/json; charset=UTF-8"'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$result = curl_exec($ch);

UPDATE::::::::::::::::::::::::::::::::::::::::::::::::::
I found a master here

0 Cevap