![]() |
Associative array as request-data in XML-RPC request - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Associative array as request-data in XML-RPC request (/showthread.php?tid=9050) |
Associative array as request-data in XML-RPC request - El Forum - 06-10-2008 [eluser]hlz[/eluser] It has been adressed before but i can't find a solid answer or a good solution. I want to post code below to a rpc-server: Code: $request = array( This doesn't work as a request. It does however work when the same array is set as a server-response. Could anyone tell me why a struct or array type cannot be used as request data? Edit: my question actually is: how does one pass key-value pairs to a xml-rpc-server if code above cannot be used? Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]hlz[/eluser] Anyone? Maybe the developer (Paul Burdick?) of this set of classes could shine a light on this? Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]gtech[/eluser] I have to say this was a complete head bender to get working, but after reading the code I got the following to work Client: Code: <?php Server: Code: <?php enjoy ![]() Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]gtech[/eluser] just edited above to add more test data Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]hlz[/eluser] That works indeed, thanks for your thoughts and work. But, there is always a but, wouldn't it be nice to have the parameters in the server like this: Code: 'you_said1' => $parameters['test'], That is what i was actually looking for. With the numeric indices it's difficult to do isset($parameters['test'])'s. Of course one could first rearrange the parameters-array and filter out the numeric indices, but that's not the point here ![]() Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [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: .... the reason why is xmlrpc will send data like: Code: <?xml version="1.0"?> 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). Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]hlz[/eluser] I had already set your conclusion as my preliminary conclusion. I guess i have to live with it then. Thanks a lot for your help. Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]gtech[/eluser] your welcome, I have learned a lot as well. Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]Jacob156[/eluser] Thank you for this code. I have been trying to find this out for the last two weeks. Associative array as request-data in XML-RPC request - El Forum - 06-11-2008 [eluser]gtech[/eluser] maybe a request to enhance the XMLRPC documentation is needed. [url="http://ellislab.com/forums/viewthread/82212/"]http://ellislab.com/forums/viewthread/82212/[/url] |