3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\XmlRpc\Request
;
12 use Zend\Stdlib\ErrorHandler
;
13 use Zend\XmlRpc\Fault
;
14 use Zend\XmlRpc\Request
as XmlRpcRequest
;
17 * XmlRpc Request object -- Request via HTTP
19 * Extends {@link Zend\XmlRpc\Request} to accept a request via HTTP. Request is
20 * built at construction time using a raw POST; if no data is available, the
21 * request is declared a fault.
23 class Http
extends XmlRpcRequest
32 * Raw XML as received via request
40 * Attempts to read from php://input to get raw POST request; if an error
41 * occurs in doing so, or if the XML is invalid, the request is declared a
45 public function __construct()
47 ErrorHandler
::start();
48 $xml = file_get_contents('php://input');
51 $this->fault
= new Fault(630);
61 * Retrieve the raw XML request
65 public function getRawRequest()
73 * Gets all headers as key => value pairs and returns them.
77 public function getHeaders()
79 if (null === $this->headers
) {
80 $this->headers
= array();
81 foreach ($_SERVER as $key => $value) {
82 if ('HTTP_' == substr($key, 0, 5)) {
83 $header = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
84 $this->headers
[$header] = $value;
89 return $this->headers
;
93 * Retrieve the full HTTP request, including headers and XML
97 public function getFullRequest()
100 foreach ($this->getHeaders() as $key => $value) {
101 $request .= $key . ': ' . $value . "\n";
104 $request .= $this->xml
;