This is a server implementation of the new XMLRPC extension in PHP 4x. that can dynamically call a class and a specific class method based on the XML methodName parameter request.
Type: application
Version: 1.0
Requires: XMLRPC extensions
Author: the mighty Indian
<?PHP
/*
What: Sample XMLRPC implementation server, that calls a defined function, object method, or includes a object on call. It uses the format ClassName.MethodName The '.' dot in a XML request methodName parameter separates a classname and a methodname.
Requires: http://www.weberdev.com/Manuals/PHP/ref.xmlrpc.html
Example:
$args=array(
xml => $HTTP_RAW_POST_DATA
);
if($REQUEST_METHOD=="POST" && !strncmp($CONTENT_TYPE,"text/xml",8)){
$xmlrpc = new XPC_xmlrpc($args);
Header("Content-Type: text/xml");
echo$xmlrpc->_RET;exit;
}else{
echo'GET Method not allowed!';exit;
}
include_once("test.php");
Class test{
function tester($args=''){
if(is_array($args)){
foreach($args as $k => $v){
$arr[$k]=$v;
}
}else{
$arr=array("Hello World!",time());
}
return $arr;
}
}
*/
Class XPC_xmlrpc{
var $_XML,$_RET,$_TYPE='xml',$_NAME='xmlrpc',$_ARGS=array();
function XPC_xmlrpc($args=''){
$this->_XML=$args['xml'];
$this->run($args);
}//end XPC_xmlrpc constructor method