• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Associative array as request-data in XML-RPC request

#6
[eluser]gtech[/eluser]
the problem is I don't think you can do what you are suggesting, in your case you just send the associative array as paramater 0

Code:
....
    $this->xmlrpc->request(array(
                                array(
                                      array(
                                            'userid'    => '99',
                                            'url'       => 'http://yoursite.com',
                                            'email'     => '[email protected]',
                                            'lastname'  => 'Smith',
                                            'firstname' => 'John'
                                      ),
                                      'struct'
                                )
                           ),
                           'struct');
...

              $response = array(
                     array(
                          'you_said2'  => $parameters['0']['userid'],
                          'you_said3'  => $parameters['0']['url'],
                          'i_respond' => 'Not bad at all.'
                     ),
                'struct');

the reason why is xmlrpc will send data like:
Code:
<?xml version="1.0"?>
<methodCall>
   <methodName>examples.getStateName</methodName>
   <params>
      <param>
         <value><i4>41</i4></value>
      </param>
      <param>
         <value><string>Another Val</string></value>
      </param>
   </params>
</methodCall>

The parameters are sent through the param tags, you don't give them a name so it will always be param0 param1 param2 etc.

say if you wanted to pass an array to a normal php function you would pass it through a paramter index, the principle is the same (thats my understanding anyway).


Messages In This Thread
Associative array as request-data in XML-RPC request - by El Forum - 06-10-2008, 05:31 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 02:31 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 07:07 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 07:25 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 07:36 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 08:01 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 08:09 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 08:18 AM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 03:32 PM
Associative array as request-data in XML-RPC request - by El Forum - 06-11-2008, 04:55 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.