Hello, there was a problem getting some data from XML. With XML in terms of PHP has not worked yet, only with JSON. I tried XML-> JSON first, but it turned out porridge.
In general, we have the following object:
SimpleXMLElement Object ( [id] => 2162624 [inv] => 0 [amount] => 0.00 [type_curr] => WMZ [sign] => 5cdd60c2316994c120fea6 [email] => тест 1 [options] => SimpleXMLElement Object ( [option] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 15885 [type] => text ) ) ) ) From it you need to get [type] => text. But I managed to get only to the option, then there is an array in the name (?):
SimpleXMLElement Object ( [@attributes] => Array ( [id] => 15885 [type] => text ) ) And it does not work out. The code itself (in the first line the XML request itself):
$xml = '<request><id>2162624</id><inv>0</inv><amount>0.00</amount><type_curr>WMZ</type_curr><sign>5cdd60c2316994c120fea6</sign><email>тест 1</email><options><option id="15885" type="text"><![CDATA[тест 15885]]></option></options></request>'; $xml = simplexml_load_string($xml); print_r($xml->options->option); What is the problem, and what does the array do there? Can I somehow get the data I need?
PS I cannot change the XML structure, I get it from the service, here I have only an example based on one of the requests.