[phpxmlrpc] Using PHPXMLRPC with TopicExchange

Saqib web at saqibkadri.net
Sat Mar 17 03:30:28 UTC 2007

TopicExchange.com seems to use a slightly different XML-RPC interface 
(documented at http://topicexchange.com/doc/xmlrpc). How would I use 
PHPXMLRPC to create a message that topicexchange would accept?

topicexchange says it wants a message of the form struct 
topicExchange.ping(string topicName, struct details), where struct 
details contains 4 (optional 5) items:
- string blog_name
- string title
- string url
- string excerpt
- boolean autoMunge (optional)

I'm trying the following:
$name_param = new xmlrpcval('Blog Name', 'string');
$title_param = new xmlrpcval('Post Title', 'string');
$url_param = new xmlrpcval('http://www.domain.com/post_url', 'string');
$excerpt_param = new xmlrpcval('Some excerpt text', 'string');
$params = array($name_param, $title_param, $url_param, $excerpt_param);

$xml_rpc_method = "topicExchange.ping";
$service_url = "http://topicexchange.com/RPC2";
$parse_url = parse_url($service_url);
$xml_rpc_server = $parse_url['host'];
$xml_rpc_port = $parse_url['port'];
if($xml_rpc_port=='') $xml_rpc_port = 80;
$xml_rpc_path = $parse_url['path'];

$message = new xmlrpcmsg($xml_rpc_method, $params);
$client = new xmlrpc_client($xml_rpc_path, $xml_rpc_server, $xml_rpc_port);
$client->debug = 2;
$response = $client->send($message);

This doesn't work; I get back: "TypeError: topicExchange_ping() takes 
exactly 3 arguments (5 given)"

What would be the proper way to structure the message so that this 
XML-RPC interface of topicExchange.ping(string topicName, struct 
details) understands it?


More information about the phpxmlrpc mailing list