Saqib --

As you can clearly see from your $params, you are sending 4 "string" variables as your parameters, when their API requests 1 string and 1 struct. ("topicName" and "details").

You're not even sending them "topicName" (the "channel" your content should appear on), so that's the first problem. Your setup should look more like this:

// make a string value for topicName
$topicName = new xmlrpcval("Some Topic Name","string");
// make a struct value for details
// creating a struct in PHPXMLRPC is just like building an associative array in PHP but all the values have to be xmlrpcvals
$details = new xmlrpcval(
    "blog_name" => new xmlrpcval("Blog Name", "string"),
    "title" => new xmlrpcval("Post Title", "string"),
    "url" => new xmlrpcval("","string";),
    "excerpt" => new xmlrpcval("foo foo foo...","string")


$params = array($topicName,$details);
$message = new xmlrpcmsg($xml_rpc_method, $params);

...and that should do the trick. I must admit, though, I'm a little confused as to why the error says their API "takes exactly 3 arguments (5 given)" when it takes _2_, and you sent _4_. Sounds like they're counting wrong over there...


On Mar 16, 2007, at 11:30 PM, Saqib wrote: seems to use a slightly different XML-RPC interface (documented at How would I use PHPXMLRPC to create a message that topicexchange would accept?

topicexchange says it wants a message of the form struct 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('', 'string');
$excerpt_param = new xmlrpcval('Some excerpt text', 'string');
$params = array($name_param, $title_param, $url_param, $excerpt_param);

$xml_rpc_method = "";
$service_url = "";;
$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 topicName, struct details) understands it?

phpxmlrpc mailing list

a.h.s. boy
spud(at)            "as yes is to if,love is to yes"

phpxmlrpc mailing list

Reply via email to