xml-rpc 1.5.1

  • U1_167799
    了解作者
  • 31.5KB
    文件大小
  • tgz
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-12 03:38
    上传日期
If PHP's mbstring extension is enabled, use mb_convert_encoding() to ensure the client payload matches the intended encoding. This is a better resolution of Bug 7376. * Turn off the default of automatically base64 encoding strings that can generate fatal errors in PHP's SAX parser. The automatic base64 encoding can be turned on via the new XML_RPC_Client::setAutoBase64() method. The auto-encoding is a workaround for systems that don't have PHP's mbstring extension available. (The automatic base64 encoding was added in the prior release, 1.4.8, and caused problems for users who don't control the receiving end of the requests.) Bug 7837.
XML_RPC-1.5.1.tgz
  • package2.xml
    22.2KB
  • XML_RPC-1.5.1
  • tests
  • protoport.php
    10.9KB
  • test_Dump.php
    1.5KB
  • empty-value.php
    2.5KB
  • types.php
    3.3KB
  • extra-lines.php
    3KB
  • allgot.inc
    1.6KB
  • empty-value-struct.php
    2.6KB
  • RPC.php
    59.7KB
  • Server.php
    22.8KB
  • Dump.php
    5.1KB
  • package.xml
    15.5KB
内容介绍
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * PHP implementation of the XML-RPC protocol * * This is a PEAR-ified version of Useful inc's XML-RPC for PHP. * It has support for HTTP transport, proxies and authentication. * * PHP versions 4 and 5 * * LICENSE: License is granted to use or modify this software * ("XML-RPC for PHP") for commercial or non-commercial use provided the * copyright of the author is preserved in any distributed or derivative work. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESSED OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category Web Services * @package XML_RPC * @author Edd Dumbill <edd@usefulinc.com> * @author Stig Bakken <stig@php.net> * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2006 The PHP Group * @version CVS: $Id: RPC.php,v 1.101 2006/10/28 16:42:34 danielc Exp $ * @link http://pear.php.net/package/XML_RPC */ if (!function_exists('xml_parser_create')) { include_once 'PEAR.php'; PEAR::loadExtension('xml'); } /**#@+ * Error constants */ /** * Parameter values don't match parameter types */ define('XML_RPC_ERROR_INVALID_TYPE', 101); /** * Parameter declared to be numeric but the values are not */ define('XML_RPC_ERROR_NON_NUMERIC_FOUND', 102); /** * Communication error */ define('XML_RPC_ERROR_CONNECTION_FAILED', 103); /** * The array or struct has already been started */ define('XML_RPC_ERROR_ALREADY_INITIALIZED', 104); /** * Incorrect parameters submitted */ define('XML_RPC_ERROR_INCORRECT_PARAMS', 105); /** * Programming error by developer */ define('XML_RPC_ERROR_PROGRAMMING', 106); /**#@-*/ /** * Data types * @global string $GLOBALS['XML_RPC_I4'] */ $GLOBALS['XML_RPC_I4'] = 'i4'; /** * Data types * @global string $GLOBALS['XML_RPC_Int'] */ $GLOBALS['XML_RPC_Int'] = 'int'; /** * Data types * @global string $GLOBALS['XML_RPC_Boolean'] */ $GLOBALS['XML_RPC_Boolean'] = 'boolean'; /** * Data types * @global string $GLOBALS['XML_RPC_Double'] */ $GLOBALS['XML_RPC_Double'] = 'double'; /** * Data types * @global string $GLOBALS['XML_RPC_String'] */ $GLOBALS['XML_RPC_String'] = 'string'; /** * Data types * @global string $GLOBALS['XML_RPC_DateTime'] */ $GLOBALS['XML_RPC_DateTime'] = 'dateTime.iso8601'; /** * Data types * @global string $GLOBALS['XML_RPC_Base64'] */ $GLOBALS['XML_RPC_Base64'] = 'base64'; /** * Data types * @global string $GLOBALS['XML_RPC_Array'] */ $GLOBALS['XML_RPC_Array'] = 'array'; /** * Data types * @global string $GLOBALS['XML_RPC_Struct'] */ $GLOBALS['XML_RPC_Struct'] = 'struct'; /** * Data type meta-types * @global array $GLOBALS['XML_RPC_Types'] */ $GLOBALS['XML_RPC_Types'] = array( $GLOBALS['XML_RPC_I4'] => 1, $GLOBALS['XML_RPC_Int'] => 1, $GLOBALS['XML_RPC_Boolean'] => 1, $GLOBALS['XML_RPC_String'] => 1, $GLOBALS['XML_RPC_Double'] => 1, $GLOBALS['XML_RPC_DateTime'] => 1, $GLOBALS['XML_RPC_Base64'] => 1, $GLOBALS['XML_RPC_Array'] => 2, $GLOBALS['XML_RPC_Struct'] => 3, ); /** * Error message numbers * @global array $GLOBALS['XML_RPC_err'] */ $GLOBALS['XML_RPC_err'] = array( 'unknown_method' => 1, 'invalid_return' => 2, 'incorrect_params' => 3, 'introspect_unknown' => 4, 'http_error' => 5, 'not_response_object' => 6, 'invalid_request' => 7, ); /** * Error message strings * @global array $GLOBALS['XML_RPC_str'] */ $GLOBALS['XML_RPC_str'] = array( 'unknown_method' => 'Unknown method', 'invalid_return' => 'Invalid return payload: enable debugging to examine incoming payload', 'incorrect_params' => 'Incorrect parameters passed to method', 'introspect_unknown' => 'Can\'t introspect: method unknown', 'http_error' => 'Didn\'t receive 200 OK from remote server.', 'not_response_object' => 'The requested method didn\'t return an XML_RPC_Response object.', 'invalid_request' => 'Invalid request payload', ); /** * Default XML encoding (ISO-8859-1, UTF-8 or US-ASCII) * @global string $GLOBALS['XML_RPC_defencoding'] */ $GLOBALS['XML_RPC_defencoding'] = 'UTF-8'; /** * User error codes start at 800 * @global int $GLOBALS['XML_RPC_erruser'] */ $GLOBALS['XML_RPC_erruser'] = 800; /** * XML parse error codes start at 100 * @global int $GLOBALS['XML_RPC_errxml'] */ $GLOBALS['XML_RPC_errxml'] = 100; /** * Compose backslashes for escaping regexp * @global string $GLOBALS['XML_RPC_backslash'] */ $GLOBALS['XML_RPC_backslash'] = chr(92) . chr(92); /**#@+ * Which functions to use, depending on whether mbstring is enabled or not. */ if (function_exists('mb_ereg')) { /** @global string $GLOBALS['XML_RPC_func_ereg'] */ $GLOBALS['XML_RPC_func_ereg'] = 'mb_eregi'; /** @global string $GLOBALS['XML_RPC_func_ereg_replace'] */ $GLOBALS['XML_RPC_func_ereg_replace'] = 'mb_eregi_replace'; /** @global string $GLOBALS['XML_RPC_func_split'] */ $GLOBALS['XML_RPC_func_split'] = 'mb_split'; } else { /** @ignore */ $GLOBALS['XML_RPC_func_ereg'] = 'eregi'; /** @ignore */ $GLOBALS['XML_RPC_func_ereg_replace'] = 'eregi_replace'; /** @ignore */ $GLOBALS['XML_RPC_func_split'] = 'split'; } /**#@-*/ /** * Should we automatically base64 encode strings that contain characters * which can cause PHP's SAX-based XML parser to break? * @global boolean $GLOBALS['XML_RPC_auto_base64'] */ $GLOBALS['XML_RPC_auto_base64'] = false; /** * Valid parents of XML elements * @global array $GLOBALS['XML_RPC_valid_parents'] */ $GLOBALS['XML_RPC_valid_parents'] = array( 'BOOLEAN' => array('VALUE'), 'I4' => array('VALUE'), 'INT' => array('VALUE'), 'STRING' => array('VALUE'), 'DOUBLE' => array('VALUE'), 'DATETIME.ISO8601' => array('VALUE'), 'BASE64' => array('VALUE'), 'ARRAY' => array('VALUE'), 'STRUCT' => array('VALUE'), 'PARAM' => array('PARAMS'), 'METHODNAME' => array('METHODCALL'), 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), 'MEMBER' => array('STRUCT'), 'NAME' => array('MEMBER'), 'DATA' => array('ARRAY'), 'FAULT' => array('METHODRESPONSE'), 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'), ); /** * Stores state during parsing * * quick explanation of components: * + ac = accumulates values * + qt = decides if quotes are needed for evaluation * + cm = denotes struct or array (comma needed) * + isf = indicates a fault * + lv = indicates "looking for a value": implements the logic * to allow values with no types to be strings * + params = stores parameters in method calls * + method = stores method name * * @global array $GLOBALS['XML_RPC_xh'] */ $GLOBALS['XML_RPC_xh'] = array(); /** * Start element handler for the XML parser * * @return void */ function XML_RPC_se($parser_resource, $name, $attrs) { global $XML_RPC_xh, $XML_RPC_valid_parents; $parser = (int) $parser_resource; // if invalid xmlrpc already detected, skip all processing if ($XML_RPC_xh[$parser]['isf'] >= 2) { return; } // check for correct element nesting // top level element can only be of 2 types if (count($XM
评论
    相关推荐