|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00024 require_once 'Zend/XmlRpc/Request.php'; 00025 00039 class Zend_XmlRpc_Request_Http extends Zend_XmlRpc_Request 00040 { 00045 protected $_headers; 00046 00051 protected $_xml; 00052 00062 public function __construct() 00063 { 00064 $xml = @file_get_contents('php://input'); 00065 if (!$xml) { 00066 require_once 'Zend/XmlRpc/Fault.php'; 00067 $this->_fault = new Zend_XmlRpc_Fault(630); 00068 return; 00069 } 00070 00071 $this->_xml = $xml; 00072 00073 $this->loadXml($xml); 00074 } 00075 00081 public function getRawRequest() 00082 { 00083 return $this->_xml; 00084 } 00085 00093 public function getHeaders() 00094 { 00095 if (null === $this->_headers) { 00096 $this->_headers = array(); 00097 foreach ($_SERVER as $key => $value) { 00098 if ('HTTP_' == substr($key, 0, 5)) { 00099 $header = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5))))); 00100 $this->_headers[$header] = $value; 00101 } 00102 } 00103 } 00104 00105 return $this->_headers; 00106 } 00107 00113 public function getFullRequest() 00114 { 00115 $request = ''; 00116 foreach ($this->getHeaders() as $key => $value) { 00117 $request .= $key . ': ' . $value . "\n"; 00118 } 00119 00120 $request .= $this->_xml; 00121 00122 return $request; 00123 } 00124 }