File indexing completed on 2024-12-22 05:36:27

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_Amf
0017  * @subpackage Request
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /** @see Zend_Amf_Request */
0024 // require_once 'Zend/Amf/Request.php';
0025 
0026 /**
0027  * AMF Request object -- Request via HTTP
0028  *
0029  * Extends {@link Zend_Amf_Request} to accept a request via HTTP. Request is
0030  * built at construction time using a raw POST; if no data is available, the
0031  * request is declared a fault.
0032  *
0033  * @package    Zend_Amf
0034  * @subpackage Request
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 class Zend_Amf_Request_Http extends Zend_Amf_Request
0039 {
0040     /**
0041      * Raw AMF request
0042      * @var string
0043      */
0044     protected $_rawRequest;
0045 
0046     /**
0047      * Constructor
0048      *
0049      * Attempts to read from php://input to get raw POST request; if an error
0050      * occurs in doing so, or if the AMF body is invalid, the request is declared a
0051      * fault.
0052      *
0053      * @return void
0054      */
0055     public function __construct()
0056     {
0057         // php://input allows you to read raw POST data. It is a less memory
0058         // intensive alternative to $HTTP_RAW_POST_DATA and does not need any
0059         // special php.ini directives
0060         $amfRequest = file_get_contents('php://input');
0061 
0062         // Check to make sure that we have data on the input stream.
0063         if ($amfRequest != '') {
0064             $this->_rawRequest = $amfRequest;
0065             $this->initialize($amfRequest);
0066         } else {
0067             echo '<p>Zend Amf Endpoint</p>' ;
0068         }
0069     }
0070 
0071     /**
0072      * Retrieve raw AMF Request
0073      *
0074      * @return string
0075      */
0076     public function getRawRequest()
0077     {
0078         return $this->_rawRequest;
0079     }
0080 }