[phpxmlrpc] new to phpxmlrpc

Jeff Barr jeff at vertexdev.com
Wed Dec 17 13:52:42 GMT 2003


Hi Sam,

You should not need to do the xmlrpc_encode, and you need to
pass in an array of parameters instead of a scalar value;
try it like this:

 > $par1=new xmlrpcval(array(
 > "first_param" => new xmlrpcval("first_value", "string"),
 > "second_param" => new xmlrpcval("second_value", "string")), "struct");
 > $f=new xmlrpcmsg("method",array($par1));
 > $r=$client->send($f);

You should also use the defined XML-RPC constants for the data types. Here
is how I would write this code:

$client = new xmlrpc_client("path", "server", 80);
$p1 = new xmlrpc_val("first_value", $xmlrpcString);
$p2 = new xmlrpc_val("second_value", $xmlrpcString);
$par1 = new xmlrpc_val(array("first_param" => $p1, "second_param" => $p2), $xmlrpcStruct);
$f=new xmlrpcmsg("method", array($par));
$r=$client->send($f);

This should work, but I don't have access to your server so I
can't say for sure.

Turning on client debugging can be helpful too. After
you create the client (first line above), try this:

$client->setDebug(1);

You can find a very comprehensive XML-RPC client at
http://groups.yahoo.com/group/syndic8-dev/files/XML-RPC%20Test%20Program/

This client calls the Syndic8 XML-RPC functions, as described at
http://www.syndic8.com/services.php .

Hope this helps!

Jeff;

 > $par1=new xmlrpcval(array(
 > "first_param" => new xmlrpcval("first_value", "string"),
 > "second_param" => new xmlrpcval("second_value", "string")), "struct");
 > $par=xmlrpc_encode($par1);
 > $f=new xmlrpcmsg("method",$par);
 > $r=$client->send($f);


> Hi everybody,
> I am new to phpxmlrpc. I downloaded the xmlrpc class and tried to use it.
> After lots of tries, I keep on getting this error:
> *Fatal error*: Cannot redeclare xmlrpc_decode() in */.../xmlrpc.inc* on 
> line *1380
> *I can get out of this, can anyone help me?
> I am working with a very simple script like this:
> 
> $client=new xmlrpc_client("path", "server", 80);
> $par1=new xmlrpcval(array(
> "first_param" => new xmlrpcval("first_value", "string"),
> "second_param" => new xmlrpcval("second_value", "string")), "struct");
> $par=xmlrpc_encode($par1);
> $f=new xmlrpcmsg("method",$par);
> $r=$client->send($f);
> 
> Thank you in advance
> Sam
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> phpxmlrpc mailing list
> phpxmlrpc at usefulinc.com
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc





More information about the phpxmlrpc mailing list