Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63234 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10991 invoked from network); 25 Sep 2012 08:02:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2012 08:02:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:57482] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/C4-58640-F2561605 for ; Tue, 25 Sep 2012 04:02:58 -0400 Received: from Hwhost2.local (unknown [194.57.88.180]) by host1.trois-doubles.net (Postfix) with ESMTPA id 89A242006A0; Tue, 25 Sep 2012 10:02:36 +0200 (CEST) Message-ID: <5061651C.1070409@hoa-project.net> Date: Tue, 25 Sep 2012 10:02:36 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0a2 MIME-Version: 1.0 To: Andrew Faulds CC: internals@lists.php.net References: <505C4A06.6040304@hoa-project.net> <5060A1C5.8070701@ajf.me> In-Reply-To: <5060A1C5.8070701@ajf.me> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] POST, content-type: application/json and json_decode From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 24/09/12 20:09, Andrew Faulds wrote: > On 21/09/12 12:05, Ivan Enderlin @ Hoa wrote: >> Hello, >> >> If PHP receives a HTTP request with the method POST and with the >> header Content-Type: application/x-www-form-encoded, then, it >> automatically parses the request body to populate an array in $_POST. >> If the Content-Type is different (e.g. text/plain or >> application/json), the request body is reachable by reading >> php://input. Well, it is ok. >> >> But is there any plans to consider application/json by parsing the >> request body and populate the result in $_POST (with the help of >> json_decode() maybe)? > I think perhaps that's the wrong approach. It's valid JSON to have a > list literal at the top level as well, I think. Perhaps we should > introduce a new $_JSON variable or some such thing? $_BODY? $_BODY === php://input. -- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/