Good day!
PHP programming language . I convert a string to an XML object:
$xml = simplexml_load_string($xmlstr); I display echo var_dump($xml);
I get this result:
object(SimpleXMLElement)#1 (6) { ["url"]=> object(SimpleXMLElement)#2 (1) { ["@attributes"]=> array(1) { ["domain"]=> string(13) "https://ya.ru" } } ["yaca"]=> object(SimpleXMLElement)#3 (1) { ["@attributes"]=> array(1) { ["url"]=> string(13) "https://ya.ru" } } ["tcy"]=> object(SimpleXMLElement)#4 (1) { ["@attributes"]=> array(2) { ["rang"]=> string(1) "6" ["value"]=> string(4) "9500" } } ["topics"]=> object(SimpleXMLElement)#5 (1) { ["topic"]=> object(SimpleXMLElement)#6 (1) { ["@attributes"]=> array(2) { ["title"]=> string(43) "Π’Π΅ΠΌΠ°: ΠΠΎΠΈΡΠΊΠΎΠ²ΡΠ΅ ΡΠΈΡΡΠ΅ΠΌΡ" ["url"]=> string(26) "http://yaca.yandex.ru/yca/" } } } ["textinfo"]=> string(113) " Π’Π΅ΠΌΠ°: ΠΠΎΠΈΡΠΊΠΎΠ²ΡΠ΅ ΡΠΈΡΡΠ΅ΠΌΡ Π Π΅Π³ΠΈΠΎΠ½: Π ΠΎΡΡΠΈΡ ΠΡΡΠΎΡΠ½ΠΈΠΊ: ΠΡΠΈΡΠΈΠ°Π»ΡΠ½ΡΠΉ" ["r1"]=> string(132) "wutwrfslmeextvlpphhotyoutxbmkulbvyuokbuxsocurtftohkircrhsjqjubpnlwfmxuhjgaxyxjrynbllcrqvtobsbtqiraide1d522c48423e52e8f6796dc9f1b3125" } I can not figure out how I get the value field value tcy . I appeal as an array, but always an empty result.
Added source XML:
<urlinfo> <url domain="https://yandex.ru"> <![CDATA[ / ]]> </url> <yaca url="https://yandex.ru"/> <tcy rang="6" value="380000"/> <topics></topics> <textinfo></textinfo> <r1> uvyerddwhdmcirwatmowxmyxpktyjugqbnhwbufhgmfvugvofkvjbfkaykbtndygknieqitmtjousnxtjjospvednwjemswehrlo68dda255ecb7540b7f383df508b14e8f </r1> </urlinfo> Thank!