|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-14 11:31 UTC] daverandom@php.net
-Status: Open
+Status: Not a bug
[2017-04-14 11:31 UTC] daverandom@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 23:00:01 2025 UTC |
Description: ------------ From client in CURL: $ch = curl_init(); $data = '{"test":"hello"}'; curl_setopt($ch, CURLOPT_URL, 'http://localhost'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: '.strlen($data)]); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $output = curl_exec($ch); var_dump($output); curl_close($ch); From server var_dump($_SERVER["CONTENT_TYPE"], $_REQUEST, $_POST); //"string(16) "application/json" array(0) { } array(0) { } " But file_get_contents("php://input") is populated Tied the same with an Ajax call and the result is identical