PHP: XML-RPC functions - Manual
PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<xml_set_unparsed_entity_decl_handlerxmlrpc_decode_request>
view the version of this page
Last updated: Wed, 29 Jan 2003

CVIII. XML-RPC functions

Introduction

These functions can be used to write XML-RPC servers and clients. You can find more information about XML-RPC at , and more documentation on this extension and it's functions at .

주의

This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.

Requirements

No external libraries are needed to build this extension.

Installation

XML-RPC support in PHP is not enabled by default. You will need to use the --with-xmlrpc[=DIR] configuration option when compiling PHP to enable XML-RPC support. This extension is bundled into PHP as of 4.1.0.

Runtime Configuration

The behaviour of these functions is affected by settings in php.ini.

표 1. XML-RPC configuration options

NameDefaultChangeable
xmlrpc_errors"0"PHP_INI_SYSTEM
xmlrpc_error_number"0"PHP_INI_ALL
For further details and definition of the PHP_INI_* constants see ini_set().

Resource Types

This extension has no resource types defined.

Predefined Constants

This extension has no constants defined.

차례
xmlrpc_decode_request -- Decodes XML into native PHP types
xmlrpc_decode -- Decodes XML into native PHP types
xmlrpc_encode_request -- Generates XML for a method request
xmlrpc_encode -- Generates XML for a PHP value
xmlrpc_get_type -- Gets xmlrpc type for a PHP value. Especially useful for base64 and datetime strings
xmlrpc_parse_method_descriptions -- Decodes XML into a list of method descriptions
xmlrpc_server_add_introspection_data -- Adds introspection documentation
xmlrpc_server_call_method -- Parses XML requests and call methods
xmlrpc_server_create -- Creates an xmlrpc server
xmlrpc_server_destroy -- Destroys server resources
xmlrpc_server_register_introspection_callback -- Register a PHP function to generate documentation
xmlrpc_server_register_method -- Register a PHP function to resource method matching method_name
xmlrpc_set_type -- Sets xmlrpc type, base64 or datetime, for a PHP string value


User Contributed Notes
XML-RPC functions
add a note add a note
ravan_n at hotmail dot com
27-Dec-2001 10:01

Refer to the below link for documentation / latest releases of the package.


cmv at php dot net
08-Jan-2002 12:26

"Latest releases" is a bit redundant, since this extension is bundled into PHP (as of 4.1.0).  You don't need to download anything from sourceforge to make this work.  Just compile PHP with the --with-xmlrpc flag.

The site is useful, however, for documentation.

nic at uklinux dot NOSPAM dot net
24-Apr-2002 04:05

An alternative XML-RPC implementation is available at - it's written in PHP so you can use it on servers for which you don't have the luxury of rebuilding PHP on.

nic

ivanr at webkreator dot com
21-Jun-2002 06:50

For a really easy way to use this XML-RPC extension take a look at

XML-RPC Class Server ()

It automatically creates servers out of PHP classes. Creating clients is almost as easy, especially with the recent addition of the overload extension to PHP (see ).

hfuecks at pinkgoblin dot com
28-Jul-2002 08:33

Anyone interested in PHP-GTK talking to an XML-RPC server:


hfuecks at pinkgoblin dot com
15-Aug-2002 03:32

This extension does not handle the process of making making XML-RPC client requests via HTTP; it only prepares the XML-RPC request payload.

This differs from many other XML-RPC implementations but offers greater flexibility, allowing SSL connections, authentication headers and XML-RPC via other transports like SMTP.

steve at orangeNOSPAMimagineering dot com
24-Aug-2002 08:32

There's a handy library by Keith Devens (version 2.2.1) at


Here is a sample client. It remotely calls sample.sumAndDifference
with two parameters (3 and 5).
It returns:

sum => 8
difference => -2

<?php
include ("kd_xmlrpc.php");
// define("XMLRPC_DEBUG", 0);    // Set to 1 for handy debugging

$method = "sample.sumAndDifference";
$params = array(XMLRPC_prepare(3), XMLRPC_prepare(5));
$request = xmlrpc_encode_request($method,$params);

$site = "xmlrpc-c.sourceforge.net";
$location = "/api/sample.php";

list($success, $result) = XMLRPC_request( $site, $location, $method, $params );

// XMLRPC_debug_print();    // uncomment for debugging

foreach ( $result as $key => $value ) {
         echo(" $key => $value \n");
}

?>

steve at orangeNOSPAMimagineering dot com
26-Aug-2002 05:08

Oops, two changes to the above code:

// This style is better:
// better // $params = XMLRPC_prepare(array(3,5));
// uncool // $params = array(XMLRPC_prepare(3), XMLRPC_prepare(5));

// This line is unnecessary, it can be safely removed:
// $request = xmlrpc_encode_request($method,$params);

hfuecks at pinkgoblin dot com
26-Sep-2002 01:34

You can pass PHP errors with the XML-RPC extension as described here:
nospam at phppatterns dot com
07-Dec-2002 12:45

Note that you do need the iconv module installed to use the XML-RPC extension (see: )
roland at php dot net
29-Jan-2003 09:15

You can find a good howto about the xml-rpc extension at



It's an easy client / server example - works quite good :-)

bmichael at goldparrot dot com
09-Feb-2003 04:52

If anyone is interested in making XMLRPC requests directly from the client, I have been able to get xmlrpc to
work with vcXMLRPC javascript backend.

After about 1 week of scanning the market, I found this solution to be the best on Javascript back end.  It uses the Microsoft.HTTP activeX control for IE, or HTTPRequest Object for Mozilla.

You include vc(Virtual Cowboys) vcXMLRPC.js file into your pages and make the rpc calls from with javascript to create the requests.

It works both ways.

Two Notes:

I have tested it on IE 6.02 and you need to change lines in ProcessRequest :
function to read:

 dom = this.getObject("XMLDOM",http.responseText);

and change the getObject function to use the latest ActiveX Control:

MSXML2.XMLHTTP.3.0  (or 4.0)
MSXML2.DOMDocument.3.0  (or 4.0)

The controls are found on MSDN in the Web Services -> XML area.

As another note, you DO NOT NEED the rpcproxy.cgi script to use this.  That is a proxy script to get around JS Security.  You can use PHP to build the proxy.  But, I was able to get the CGI working with GCC compiler on Solaris (change the -KPCI, depend and -x03 optimizer settings in the Makefile )

daniel(at)lorch.cc
25-Mar-2003 12:21

If you need a tutorial on the XML-RPC-Extension go to devshed:

 

mistcat attyatatat phreaker dootttt net
17-Apr-2003 10:52

Hope this saves somone some frustration:
As of php 4.3.1 and xmlrpc-epi-php-0.51 php would return a content type text/html instead of text/xml in its responses.  this is a bad thing.  Perl's XMLRPC::Lite for instance will not like you if you do this.  Happily the solution is simple:

header("Content-Type: text/xml");

Happy Hunting.

-Nate

add a note add a note

<xml_set_unparsed_entity_decl_handlerxmlrpc_decode_request>
 Last updated: Wed, 29 Jan 2003
show source | credits | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: /
Last updated: Fri May 23 21:10:19 2003 CEST