Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
186
PHP XML RPC Function ServerCreate
PHP Version: (PHP 4 >= 4.1.0, PHP 5)
Description
This function is used to
create a RPC server. The server can then be used for serving your request.
Usage:
resource xmlrpc_server_create (
void )
Using this method you can
create a server. The basic steps for implementation of server in PHP are to
create a server and register set of methods which can be used by this server. All
methods can be registered by using xmlrpc_server_register_method() function. A
function registers with the server with a name that can be viewed from outside
world.
Please find the code below
for creating a server and registering a function with the server.
PHP
Code:
<?php
//This method will be
invoked by the server.
function dummyresponse($method, $params) {
switch($params[0]) {
case 'test1':
$reply = 'Your request string
contains test1.';
break;
case 'test2':
$reply = 'Your request string contains test2.';
break;
default:
$reply = 'You have requested with no
parameters';
}
return $reply;
}
//create a server
$server = xmlrpc_server_create();
//register the 'dummyserver' name as external name and then the 'dummyresponse' name is the actual