[ciapug] PHP xml-rpc parameters
Dave J. Hala Jr.
ciapug@cialug.org
Sat, 30 Apr 2005 06:51:22 -0500
I tried this and the error went away, I haven't confirmed that the array
is still intact, but at least I'm not getting the error messages...
$params = array (
XML_RPC_encode(user),
XML_RPC_encode(password),
XML_RPC_encode(agency),
XML_RPC_encode($data),
);
On Sat, 2005-04-30 at 00:27, Tony Bibbs wrote:
> I've run into this very problem before under php4 but what I did escapes
> me. You may be right, the code may not be able to handle arrays of
> arrays...only way to say for sure would be to pour through the RPC.php
> file and check that as it loops through the array values it is checking
> to see if the content is an array.
>
> I'd start by sending over a simple single dimension array and see if
> that works. Not that it would help you but PHP5's built in xml_rpc
> support is quite nice.
>
> --Tony
>
> Dave J. Hala Jr. wrote:
> > I'm trying pass some parameters to am xmlrpc procedure from a php
> > client.
> >
> > I get the following errors:
> >
> > Warning: reset(): Passed variable is not an array or object in
> > /usr/share/pear/XML/RPC.php on line 877
> >
> > Warning: Variable passed to each() is not an array or object in
> > /usr/share/pear/XML/RPC.php on line 878
> >
> > Variable $p4 is the problem child.
> >
> > Here's what the php data structure for $data looks like:
> > array(2) {
> > [0]=>
> > array(2) {
> > ["ACN"]=>
> > string(17) "32-46-033-1892-08"
> > ["DEN"]=>
> > string(1) "9"
> >
> > }
> > [1]=>
> > array(2) {
> > ["ACN"]=>
> > string(17) "42-56-133-2892-09"
> > ["DEN"]=>
> > string(4) "9"
> >
> > }
> > }
> >
> > I took this data and did the following:
> >
> > $xml_data = XML_RPC_encode($data);
> >
> > Then I sent up the parameters array:
> >
> > # make the parameters for the procedure an array
> > $p1 = new XML_RPC_Value('user','string');
> > $p2 = new XML_RPC_Value('password','string');
> > $p3 = new XML_RPC_Value('agency','string');
> > $p4 = new XML_RPC_Value($xml_data,'array');
> > $params = array($p1, $p2,$p3,$p4);
> >
> > # define the message that calls the procedure we want
> > # parameters are username,password,data
> > $message = new XML_RPC_Message('post.notifications', $params);
> >
> > When it makes the call I get the errors. If I remove $p4 the errors go
> > away. Am I doing something wrong when passing in the array?
> >
> > Can I not pass parameters as array's of arrays?
> >
> >
> > Any thoughts?
> >
> > :) Dave
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
--
Open Source Information Systems (OSIS)
Dave J. Hala Jr. <dave@osis.us>
641.485.1606