Basically building a SOAP Client, and part of the required input is formatted as so:
<Attributes>
<Attribute>
<AttributeType>HomeType</AttributeType>
<Value>duplex</Value>
</Attribute>
<Attribute>
<AttributeType>Bedrooms</AttributeType>
<Value>2</Value>
</Attribute>
<Attribute>
<AttributeType>Bathrooms</AttributeType>
<Value>2</Value>
</Attribute>
</Attributes>
This is posted via an Array:
$homeType = array (
'AttributeType' => 'HomeType',
'Value' => $_POST['hometype']
);
$bedrooms = array (
'AttributeType' => 'Bedrooms',
'Value' => $_POST['bedrooms']
);
$bathrooms = array(
'AttributeType' => 'Bathrooms',
'Value' => $_POST['bathrooms']
);
$attributes = array (
'Attribute' => $homeType,
'Attribute' => $bedrooms,
'Attribute' => $bathrooms
);
And as you can imagine, all the Array returns is the last attribute, so the xml looks like:
<Attributes>
<Attribute>
<AttributeType>Bathrooms</AttributeType>
<Value>2</Value>
</Attribute>
</Attributes>
I can’t think of any practical way around this, as the Attributes can count up to 30-50, so I don’t want to numerically key them, especially as the array is only called as:
'Attributes' => $attributes,
Any help would be massively appreciated!
Shouldn’t you just use an array?
$attributes = array(
‘Attribute’ => array($homeType, $bedrooms, $bathrooms)
);