Re: Xmlrpc sending an array of rooms - NEED HELP

Daniele Reho <[email protected]> Thu, 13 Sep 2018 20:03:10 +0200
Newsgroups gmane.comp.php.xml-rpc
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============2866316860242942098==
Content-Type: multipart/alternative;
 boundary="------------92959AD8D5FCD3BA772E8FB5"
Content-Language: it

This is a multi-part message in MIME format.
--------------92959AD8D5FCD3BA772E8FB5
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

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

--------------92959AD8D5FCD3BA772E8FB5
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello everyone, i'm using library <span style="color: rgb(0, 0, 0);
      font-family: Verdana, Arial, sans-serif; font-size: 13px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-weight: 400; letter-spacing:
      normal; orphans: 2; text-align: left; text-indent: 0px;
      text-transform: none; white-space: normal; widows: 2;
      word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial; display: inline
      !important; float: none;">xmlrpc but i cant understand this error</span><br
      style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
      sans-serif; font-size: 13px; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      text-decoration-style: initial; text-decoration-color: initial;">
    <span style="color: rgb(0, 0, 0); font-family: Verdana, Arial,
      sans-serif; font-size: 13px; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      letter-spacing: normal; orphans: 2; text-align: left; text-indent:
      0px; text-transform: none; white-space: normal; widows: 2;
      word-spacing: 0px; -webkit-text-stroke-width: 0px;
      text-decoration-style: initial; text-decoration-color: initial;
      font-weight: bold;"><b style="color: rgb(0, 0, 0); font-family:
        &quot;Times New Roman&quot;; font-size: medium; font-style:
        normal; font-variant-ligatures: normal; font-variant-caps:
        normal; letter-spacing: normal; orphans: 2; text-align: start;
        text-indent: 0px; text-transform: none; white-space: normal;
        widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
        text-decoration-style: initial; text-decoration-color: initial;">Fatal
        error</b><span style="color: rgb(0, 0, 0); font-family:
        &quot;Times New Roman&quot;; font-size: medium; font-style:
        normal; font-variant-ligatures: normal; font-variant-caps:
        normal; font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; text-decoration-style: initial;
        text-decoration-color: initial; display: inline !important;
        float: none;">: Call to a member function serialize() on integer
        in<span> </span></span><b style="color: rgb(0, 0, 0);
        font-family: &quot;Times New Roman&quot;; font-size: medium;
        font-style: normal; font-variant-ligatures: normal;
        font-variant-caps: normal; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; text-decoration-style: initial;
        text-decoration-color: initial;">/web/htdocs/www.site.xxx/dir/phpxmlrpc-4.0.0/src/Value.php</b><span
        style="color: rgb(0, 0, 0); font-family: &quot;Times New
        Roman&quot;; font-size: medium; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; text-decoration-style: initial;
        text-decoration-color: initial; display: inline !important;
        float: none;"><span> </span>on line<span> </span></span><b
        style="color: rgb(0, 0, 0); font-family: &quot;Times New
        Roman&quot;; font-size: medium; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        letter-spacing: normal; orphans: 2; text-align: start;
        text-indent: 0px; text-transform: none; white-space: normal;
        widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
        text-decoration-style: initial; text-decoration-color: initial;">290</b><br
        style="color: rgb(0, 0, 0); font-family: &quot;Times New
        Roman&quot;; font-size: medium; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; text-decoration-style: initial;
        text-decoration-color: initial;">
    </span><span style="color: rgb(0, 0, 0); font-family: Verdana,
      Arial, sans-serif; font-size: 13px; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      letter-spacing: normal; orphans: 2; text-align: left; text-indent:
      0px; text-transform: none; white-space: normal; widows: 2;
      word-spacing: 0px; -webkit-text-stroke-width: 0px;
      text-decoration-style: initial; text-decoration-color: initial;
      font-weight: bold;"></span><br>
    <br>
      my php code is<br>
    <font color="#6666cc">    $roomdays =<br>
            array(<br>
                   'id'=&gt;'12',<br>
                   'days' =&gt;<br>
                         array(<br>
                              array(<br>
                                  'avail'=&gt;5,<br>
                                  'no_ota'=&gt;1<br>
                              ), 'struct')<br>
            );<br>
      <br>
          $args= array(new xmlrpcval('12121xxxxxxx.xxxx', 'string'), new
      xmlrpcval('1231654', 'int'), new xmlrpcval('16/09/2018',
      'string'), new xmlrpcval($roomdays, 'array'));<br>
          $message = new xmlrpcmsg('update_avail', $args);<br>
          $struct = $server-&gt;send($message)-&gt;value();  </font><br>
    <br>
    json_encode($roomdays) response of <font color="#6666cc">$roomdays</font>
    is:<br>
    <br>
    <font color="#6666cc">{"id":"12","days":[{"avail":5,"no_ota":1},"struct"]}<br>
    </font><br>
    but should be (as this guide says: <a class="moz-txt-link-freetext"
href="https://tdocs.wubook.net/wired/avail.html#using-update-avail">https://tdocs.wubook.net/wired/avail.html#using-update-avail</a>)<br>
    <br>
    <font color="#6666cc">roomdays= [<br>
        # The first room:<br>
        {'id': 1, 'days': [{'avail': 1}, {}, {'no_ota': 0}],<br>
        # The second room:<br>
        {'id': 2, 'days': [{'price': 120}, {'closed': 1}, {}],<br>
      ]<br>
    </font><br>
    printing <font color="#6666cc">$roomdays</font> i obtain<br>
    <font color="#6666cc"><br>
      (<br>
          [id] =&gt; 98970<br>
          [days] =&gt; Array<br>
              (<br>
                  [0] =&gt; Array<br>
                      (<br>
                          [avail] =&gt; 5<br>
                          [no_ota] =&gt; 1<br>
                      )<br>
      <br>
                  [1] =&gt; struct<br>
              )<br>
      <br>
      )</font><br>
    <br>
    <br>
    <b>xmlrpcval object is:<br>
      <br>
    </b><font color="#6666cc"><br>
      <br>
      Array<br>
      (<br>
          [0] =&gt; xmlrpcval Object<br>
              (<br>
                  [me] =&gt; Array<br>
                      (<br>
                          [string] =&gt; </font><font color="#6666cc"><font
        color="#6666cc">12121xxxxxxx.xxxx</font><br>
                      )<br>
      <br>
                  [mytype] =&gt; 1<br>
                  [_php_class] =&gt; <br>
              )<br>
      <br>
          [1] =&gt; xmlrpcval Object<br>
              (<br>
                  [me] =&gt; Array<br>
                      (<br>
                          [int] =&gt; </font><font color="#6666cc"><font
        color="#6666cc">1231654</font><br>
                      )<br>
      <br>
                  [mytype] =&gt; 1<br>
                  [_php_class] =&gt; <br>
              )<br>
      <br>
          [2] =&gt; xmlrpcval Object<br>
              (<br>
                  [me] =&gt; Array<br>
                      (<br>
                          [string] =&gt; 16/09/2018<br>
                      )<br>
      <br>
                  [mytype] =&gt; 1<br>
                  [_php_class] =&gt; <br>
              )<br>
      <br>
          [3] =&gt; xmlrpcval Object<br>
              (<br>
                  [me] =&gt; Array<br>
                      (<br>
                          [array] =&gt; Array<br>
                              (<br>
                                  [id] =&gt; 12<br>
                                  [days] =&gt; Array<br>
                                      (<br>
                                          [0] =&gt; Array<br>
                                              (<br>
                                                  [avail] =&gt; 5<br>
                                                  [no_ota] =&gt; 1<br>
                                              )<br>
      <br>
                                          [1] =&gt; struct<br>
                                      )<br>
      <br>
                              )<br>
      <br>
                      )<br>
      <br>
                  [mytype] =&gt; 2<br>
                  [_php_class] =&gt; <br>
              )<br>
      <br>
      )<br>
    </font><b><br>
    </b> Could You please help me understanding why i can not be able to
    send rooms array?<br>
    Thank You so much. Daniele.
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br /> <table style="border-top: 1px solid #D3D4DE;">
	<tr>
      <td style="width: 55px; padding-top: 18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
		<td style="width: 470px; padding-top: 17px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Mail priva di virus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a> 		</td>
	</tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>

--------------92959AD8D5FCD3BA772E8FB5--

--===============2866316860242942098==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KcGhweG1scnBj
IG1haWxpbmcgbGlzdApwaHB4bWxycGNAbGlzdHMudXNlZnVsaW5jLmNvbQpodHRwOi8vbGlzdHMu
dXNlZnVsaW5jLmNvbS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vcGhweG1scnBjCg==

--===============2866316860242942098==--