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

Learn More

How to create a XMLRPC Server and a XMLRPC Client [PHP]

Forked from How to create a XMLRPC Server.

2357 Runs 12443 Views 6659 Copies


gtsolutions 373

published 4 years ago


 * PHP XMLRPC - How to create a XMLRPC Server
//call the "say_hello" method of the XMLRPC Server
//and pass "John" as the first parameter
$request = xmlrpc_encode_request("say_hello", array('John'));
//create the stream context for the request
$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml\r\nUser-Agent: PHPRPC/1.0\r\n",
    'content' => $request

//URL of the XMLRPC Server
$server = 'http://localhost/server.php';
$file = file_get_contents($server, false, $context);
//decode the XMLRPC response
$response = xmlrpc_decode($file);
//display the response
echo $response;
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).