Speed up development with full-stack environments for every branch.

Learn More

How to create a XMLRPC Server [PHP]

Forked from How to to generate XML for a XMLRPC method request.

137 Runs 961 Views 206 Copies


gtsolutions 373

published 4 years ago


 * PHP XMLRPC - How to create a XMLRPC Server

//The easiest way to read an XMLRPC request is through the input stream
$request_xml = file_get_contents("php://input");

//create a basic demo method for the server to use
//in this case a function that returns users's IP address
function my_ip_address($method_name) {
    return $_SERVER['REMOTE_ADDR'];

//create the XMLRPC server
$xmlrpc_server = xmlrpc_server_create();

//register the demo method to the XMLRPC server
xmlrpc_server_register_method($xmlrpc_server, "my_ip_address", "my_ip_address");

//start the server listener
xmlrpc_server_call_method($xmlrpc_server, $request_xml, array());
echo "XMLRPC Server Started";
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).