View source
<?php
include_once './xmlrpc-2.1/lib/xmlrpc.inc';
$client = new xmlrpc_client("/xmlrpc.php", "example.com", 80);
$username = php_xmlrpc_encode('valid drupal username');
$password = php_xmlrpc_encode('valid drupal password');
$node = php_xmlrpc_encode(array(
'title' => 'XML-RPC case posted from xmlrpc_example.php',
'body' => 'Delete this test case, submitted via XML-RPC.',
'type' => 'casetracker_basic_case',
'uid' => 1,
'pid' => 14,
'status' => 1,
'case_priority_id' => 1,
'case_status_id' => 7,
'case_type_id' => 14,
));
$message = new xmlrpcmsg('casetracker.newCase', array(
$username,
$password,
$node,
));
$response = $client
->send($message);
if (!$response
->faultCode()) {
print php_xmlrpc_decode($response
->value()) . "\n";
}
else {
print "An error occurred. Code: " . htmlspecialchars($response
->faultCode()) . " Reason: '" . htmlspecialchars($response
->faultString()) . "'\n";
}