[phpxmlrpc] Xmlrpc sending an array of rooms - NEED HELP

Daniele Reho danireho at tin.it
Thu Sep 13 14:03:10 EDT 2018


Hello everyone, i'm using library xmlrpc but i cant understand this error
*Fatal error*: Call to a member function serialize() on integer 
in*/web/htdocs/www.site.xxx/dir/phpxmlrpc-4.0.0/src/Value.php*on line*290*


   my php code is
     $roomdays =
       array(
              'id'=>'12',
              'days' =>
                    array(
                         array(
                             'avail'=>5,
                             'no_ota'=>1
                         ), 'struct')
       );

     $args= array(new xmlrpcval('12121xxxxxxx.xxxx', 'string'), new 
xmlrpcval('1231654', 'int'), new xmlrpcval('16/09/2018', 'string'), new 
xmlrpcval($roomdays, 'array'));
     $message = new xmlrpcmsg('update_avail', $args);
     $struct = $server->send($message)->value();

json_encode($roomdays) response of $roomdays is:

{"id":"12","days":[{"avail":5,"no_ota":1},"struct"]}

but should be (as this guide says: 
https://tdocs.wubook.net/wired/avail.html#using-update-avail)

roomdays= [
   # The first room:
   {'id': 1, 'days': [{'avail': 1}, {}, {'no_ota': 0}],
   # The second room:
   {'id': 2, 'days': [{'price': 120}, {'closed': 1}, {}],
]

printing $roomdays i obtain

(
     [id] => 98970
     [days] => Array
         (
             [0] => Array
                 (
                     [avail] => 5
                     [no_ota] => 1
                 )

             [1] => struct
         )

)


*xmlrpcval object is:

*

Array
(
     [0] => xmlrpcval Object
         (
             [me] => Array
                 (
                     [string] => 12121xxxxxxx.xxxx
                 )

             [mytype] => 1
             [_php_class] =>
         )

     [1] => xmlrpcval Object
         (
             [me] => Array
                 (
                     [int] => 1231654
                 )

             [mytype] => 1
             [_php_class] =>
         )

     [2] => xmlrpcval Object
         (
             [me] => Array
                 (
                     [string] => 16/09/2018
                 )

             [mytype] => 1
             [_php_class] =>
         )

     [3] => xmlrpcval Object
         (
             [me] => Array
                 (
                     [array] => Array
                         (
                             [id] => 12
                             [days] => Array
                                 (
                                     [0] => Array
                                         (
                                             [avail] => 5
                                             [no_ota] => 1
                                         )

                                     [1] => struct
                                 )

                         )

                 )

             [mytype] => 2
             [_php_class] =>
         )

)
*
* Could You please help me understanding why i can not be able to send 
rooms array?
Thank You so much. Daniele.


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20180913/4cd69a6b/attachment.html>


More information about the phpxmlrpc mailing list