File indexing completed on 2024-12-29 05:27:46

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Json
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /**
0023  * @see Zend_Json_Server_Request
0024  */
0025 // require_once 'Zend/Json/Server/Request.php';
0026 
0027 /**
0028  * @category   Zend
0029  * @package    Zend_Json
0030  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0031  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0032  */
0033 class Zend_Json_Server_Request_Http extends Zend_Json_Server_Request
0034 {
0035     /**
0036      * Raw JSON pulled from POST body
0037      * @var string
0038      */
0039     protected $_rawJson;
0040 
0041     /**
0042      * Constructor
0043      *
0044      * Pull JSON request from raw POST body and use to populate request.
0045      *
0046      * @return void
0047      */
0048     public function __construct()
0049     {
0050         $json = file_get_contents('php://input');
0051         $this->_rawJson = $json;
0052         if (!empty($json)) {
0053             $this->loadJson($json);
0054         }
0055     }
0056 
0057     /**
0058      * Get JSON from raw POST body
0059      *
0060      * @return string
0061      */
0062     public function getRawJson()
0063     {
0064         return $this->_rawJson;
0065     }
0066 }