Welcome Guest, Not a member yet? Register   Sign In
xmlrpc question
#1

[eluser]nigelb[/eluser]
I am trying to submit the following information to the XMLRPC server, basically it will be order information and then an array of the Products that make up the order.

I am working with the following code but am getting stuck a variety of error messages such as " htmlspecialchars() expects parameter 1 to be string, array given"

Code:
$request = array(
                   array(
                      // Param 0
                      array('totalOrder'=>10),'struct'),
                       array(
                             // Param 1
                             array(array('productcode'=>1010,'shape'=>'round'),
                                   array('productcode'=>1010,'shape'=>'round')),
                             'struct'
                       )
              );

Anyone got any idea how I can submit the product information as an array.
#2

[eluser]Nick Husher[/eluser]
CodeIgniter's XML-RPC library typically expects values in the following format:
Code:
ARRAY
    0 => DATA
    1 => DATA_TYPE
ENDARRAY

The section where you're defining multiple products (productcode=>1010, shape=>round) and then declaring the array of them as structs is probably where your error is coming from. You need to explicitly declare data types for every discrete unit of data to expect good results. For the second parameter, try something like this:

Code:
array(
        array(
            array(
                array(
                    'productcode'=>1010,
                    'shape'=>'round'
                ),
                'struct'
            ),
            array(
                array(
                    'productcode'=>1010,
                    'shape'=>'round'
                ),
                'struct'
            )
        ),
        'array'
    )

I haven't tested it, but it I think it's in the right direction.
#3

[eluser]nigelb[/eluser]
works great, thank you




Theme © iAndrew 2016 - Forum software by © MyBB