Source of file Stdin.php
Size: 1,521 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/XmlRpc/Request/Stdin.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\XmlRpc\Request; use Zend\XmlRpc\Request as XmlRpcRequest; use Zend\XmlRpc\Fault; /** * XmlRpc Request object -- Request via STDIN * * Extends {@link Zend\XmlRpc\Request} to accept a request via STDIN. Request is * built at construction time using data from STDIN; if no data is available, the * request is declared a fault. */ class Stdin extends XmlRpcRequest { /** * Raw XML as received via request * @var string */ protected $xml; /** * Constructor * * Attempts to read from php://stdin to get raw POST request; if an error * occurs in doing so, or if the XML is invalid, the request is declared a * fault. * */ public function __construct() { $fh = fopen('php://stdin', 'r'); if (!$fh) { $this->fault = new Fault(630); return; } $xml = ''; while (!feof($fh)) { $xml .= fgets($fh); } fclose($fh); $this->xml = $xml; $this->loadXml($xml); } /** * Retrieve the raw XML request * * @return string */ public function getRawRequest() { return $this->xml; } } |