|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Amf |
|
17 * @subpackage Request |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** @see Zend_Amf_Request */ |
|
24 require_once 'Zend/Amf/Request.php'; |
|
25 |
|
26 /** |
|
27 * AMF Request object -- Request via HTTP |
|
28 * |
|
29 * Extends {@link Zend_Amf_Request} to accept a request via HTTP. Request is |
|
30 * built at construction time using a raw POST; if no data is available, the |
|
31 * request is declared a fault. |
|
32 * |
|
33 * @package Zend_Amf |
|
34 * @subpackage Request |
|
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
36 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
37 */ |
|
38 class Zend_Amf_Request_Http extends Zend_Amf_Request |
|
39 { |
|
40 /** |
|
41 * Raw AMF request |
|
42 * @var string |
|
43 */ |
|
44 protected $_rawRequest; |
|
45 |
|
46 /** |
|
47 * Constructor |
|
48 * |
|
49 * Attempts to read from php://input to get raw POST request; if an error |
|
50 * occurs in doing so, or if the AMF body is invalid, the request is declared a |
|
51 * fault. |
|
52 * |
|
53 * @return void |
|
54 */ |
|
55 public function __construct() |
|
56 { |
|
57 // php://input allows you to read raw POST data. It is a less memory |
|
58 // intensive alternative to $HTTP_RAW_POST_DATA and does not need any |
|
59 // special php.ini directives |
|
60 $amfRequest = file_get_contents('php://input'); |
|
61 |
|
62 // Check to make sure that we have data on the input stream. |
|
63 if ($amfRequest != '') { |
|
64 $this->_rawRequest = $amfRequest; |
|
65 $this->initialize($amfRequest); |
|
66 } else { |
|
67 echo '<p>Zend Amf Endpoint</p>' ; |
|
68 } |
|
69 } |
|
70 |
|
71 /** |
|
72 * Retrieve raw AMF Request |
|
73 * |
|
74 * @return string |
|
75 */ |
|
76 public function getRawRequest() |
|
77 { |
|
78 return $this->_rawRequest; |
|
79 } |
|
80 } |