<?php
set_time_limit(0);
$post_url = 'http://<your-ip-address>:8365/xmlrpc.php?xml=';
//specify the method we are calling
$method = 'method_name';
// create parameter array
$params = array('mypass', // Cortex password - REQUIRED
1, // server id - REQUIRED
// more params...
);
// encode xmlrpc request
$xml_request = xmlrpc_encode_request($method,$params);
// make the request
$response = @file_get_contents($post_url.urlencode(substr($xml_request,strpos($xml_request,"\n")+1)));
if (!$response) { // failed
echo 'unable to execute xmlrpc request';
} else {
$result = xmlrpc_decode($response);
if (isset($result['Exception'])) {
die($result['Exception']);
} else {
if ($result) {
echo 'Success!';
}
}
}
?>
Cortex - Sample XML-RPC client
Submitted by Micky on Thu, 05/03/2007 - 16:37
- Login to post comments