O
O
on_click2019-12-25 01:22:37
PHP
on_click, 2019-12-25 01:22:37

How to properly pass data to xmlrpc_encode_request?

Greetings, I'm trying to deal with xmlrpc
In the open spaces, I found this example

xmlrpc_encode_request('examples.getStateName', [41]);
формируется такой xml=>

<methodCall>
<methodName>examples.getStateName</methodName>
<params>
 <param>
  <value>
   <int>41</int>
  </value>
 </param>
</params>
</methodCall>

in the api documentation I see this request
<PCDescRQ Lang="en">
 <Auth>
   <Username>string</Username>
   <Password>string</Password>
 </Auth>
 <PcId>string</UnitId>
 <SessionID>string</SessionID>
</PCDescUnitRQ>
and I can't figure out if it's possible to create such a request via xmlrpc_encode_request(PCDescRQ...)
Any example, link to a good article with the basics of xmlrpc.php
Thank you!
=========UPD=========
Did I understand correctly that it should look something like this?
It's like too much...
$request = xmlrpc_encode_request(
  'PCDescRQ', 
  array(
    "Auth"=>array("username"=>"string", "password" => "string"),
    "PcId"=>"string",
    "SessionID"=>"string"
  )
);
=>
XML here

<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>PCDescRQ</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>Auth</name>
     <value>
      <struct>
       <member>
        <name>username</name>
        <value>
         <string>string</string>
        </value>
       </member>
       <member>
        <name>password</name>
        <value>
         <string>string</string>
        </value>
       </member>
      </struct>
     </value>
    </member>
    <member>
     <name>PcId</name>
     <value>
      <string>string</string>
     </value>
    </member>
    <member>
     <name>SessionID</name>
     <value>
      <string>string</string>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question