Associative array as request-data in XML-RPC request |
[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?
[eluser]hlz[/eluser]
Anyone? Maybe the developer (Paul Burdick?) of this set of classes could shine a light on this?
[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
[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
[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).
[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.
[eluser]Jacob156[/eluser]
Thank you for this code. I have been trying to find this out for the last two weeks.
[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] |
Welcome Guest, Not a member yet? Register Sign In |