WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : XMLRPC server class and handler
Categories : PHP, PHP Classes, XML Click here to Update Your Picture
lalith nayak
Date : Jan 28th 2006
Grade : 2 of 5 (graded 4 times)
Viewed : 4350
File : No file for this code example.
Images : No Images for this code example.
Search : More code by lalith nayak
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

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

   
function run($args=''){
       
$xmlrpc_server = xmlrpc_server_create();
       
$arr = xmlrpc_parse_method_descriptions($this->_XML);
        if(
$xmlrpc_server){
            if(!
xmlrpc_server_register_method($xmlrpc_server,$arr['methodName'],'handler')){
                die(
"<h2>method registration failed.</h2>");
            }

           
$this->_RET = xmlrpc_server_call_method($xmlrpc_server,$this->_XML,array(you,love,me),array(output_type=>$this->_TYPE));
           
$success = xmlrpc_server_destroy($xmlrpc_server);
        }

    }
//end run method

}//End XPC_xmlrpc Class

   
function handler($method_name,$params,$app_data){
         if(
preg_match("/^(.+)\.(.+)$/",$method_name,$match)){

           
$class = str_replace(".","_",$match[1]);
           
$name = strtolower($match[2]);

            if(!
class_exists($class)){
                return array(
"3","unable to find class '$class'");
            }elseif(
array_search($name,get_class_methods($class))===null){
                return array(
"4","unable to find method '$name' in class '$class'");
            }else{
               
$handler = array(new $class, $match[2]);
            }
        }else{
           
$handler = $method_name;
        }

        if(
is_array($handler)){
           
$ret = call_user_func_array($handler,array(arra=>array_merge($app_data,$params)));
        }else{
           
$ret = call_user_func_array($handler,array(arra=>array_merge($app_data,$params)));
        }
    return
$ret;
    }
//End handler method

?>



Directory Listing To XML : Outputs XML File of a Given Directory Listing
Categories : PHP, PHP Classes, XML, Directories
[PHP5] PHP Debugger and Helper
Categories : PHP, PHP Classes, Errors and Logging, Debugging, XML
XML easy parser
Categories : PHP, XML, PHP Classes
XPath for PHP without the DOM XML extension
Categories : DOM XML, XML, XSLT, PHP Classes, PHP
XML To Array
Categories : PHP, PHP Classes, XML, Arrays
RSS parser. Parses RSS into an array. Quick and nasty but does the job. No checking is done for correct Tags, only correct XML. PHP4 needed to display result (uses print_r).
Categories : PHP, XML, PHP Classes, Rich Site Summary (RSS)
Freshmeat.net XML-RPC - This class is meant to query Freshmeat for information about registered projects.
Categories : PHP, PHP Classes, XML, Web Services
XML Menu
Categories : PHP, PHP Classes, Navigation, XML, XSL
DBXML- A Class to backup databases in XML Format using web interface
Categories : PHP, PHP Classes, Databases, MySQL, XML
A very basic and fast XML parser
Categories : PHP, PHP Classes, XML
logger class (PHP5 +)
Categories : PHP, PHP Classes, Log Files, XML
TAB_STRUCT Class: Is supporting Class for the DBXML Class
Categories : PHP, PHP Classes, MySQL, XML, Databases
Sort the results from a SELECT query (any number of columns) into an array automatically.
Categories : PHP, PHP Classes, Arrays, Databases, MySQL
usercounter class
Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables
Most of the browsers, especially Internet Explorer, behave in different ways. Hence it become necessary to use Browser detection to fix the non standard behavior of the browser. This is a browser sniffer class that can be used for the above purpose.
Categories : PHP, PHP Classes, Browsers