~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/XmlRpc/Request/Stdin.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_Controller
 
17
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
18
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
19
 */
 
20
 
 
21
/**
 
22
 * Zend_XmlRpc_Request
 
23
 */
 
24
require_once 'Zend/XmlRpc/Request.php';
 
25
 
 
26
/**
 
27
 * XmlRpc Request object -- Request via STDIN
 
28
 *
 
29
 * Extends {@link Zend_XmlRpc_Request} to accept a request via STDIN. Request is
 
30
 * built at construction time using data from STDIN; if no data is available, the
 
31
 * request is declared a fault.
 
32
 *
 
33
 * @category Zend
 
34
 * @package  Zend_XmlRpc
 
35
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
36
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
37
 * @version $Id: Stdin.php 8064 2008-02-16 10:58:39Z thomas $
 
38
 */
 
39
class Zend_XmlRpc_Request_Stdin extends Zend_XmlRpc_Request
 
40
{
 
41
    /**
 
42
     * Raw XML as received via request
 
43
     * @var string
 
44
     */
 
45
    protected $_xml;
 
46
 
 
47
    /**
 
48
     * Constructor
 
49
     *
 
50
     * Attempts to read from php://stdin to get raw POST request; if an error
 
51
     * occurs in doing so, or if the XML is invalid, the request is declared a
 
52
     * fault.
 
53
     *
 
54
     * @return void
 
55
     */
 
56
    public function __construct()
 
57
    {
 
58
        $fh = fopen('php://stdin', 'r');
 
59
        if (!$fh) {
 
60
            $this->_fault = new Zend_XmlRpc_Server_Exception(630);
 
61
            return;
 
62
        }
 
63
 
 
64
        $xml = '';
 
65
        while (!feof($fh)) {
 
66
            $xml .= fgets($fh);
 
67
        }
 
68
        fclose($fh);
 
69
 
 
70
        $this->_xml = $xml;
 
71
 
 
72
        $this->loadXml($xml);
 
73
    }
 
74
 
 
75
    /**
 
76
     * Retrieve the raw XML request
 
77
     *
 
78
     * @return string
 
79
     */
 
80
    public function getRawRequest()
 
81
    {
 
82
        return $this->_xml;
 
83
    }
 
84
}