I know there are topics related to MusicBrainz which has help me so far, but I am stuck on the below.
I cannot echo the values from the result
<?php
ini_set('user_agent', 'MyApp/1.0 ([email protected])') ;
$xml = simplexml_load_file('http://musicbrainz.org/ws/2/artist/?query=artist:eminem');
print_r($xml);
?>
PHP result sample
SimpleXMLElement Object
(
[@attributes] => Array
(
[created] => 2021-01-08T14:46:14.802Z
)
[artist-list] => SimpleXMLElement Object
(
[@attributes] => Array
(
[count] => 1
[offset] => 0
)
[artist] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => b95ce3ff-3d05-4e87-9e01-c97b66af13d4
[type] => Person
[type-id] => b6e035f4-3ce9-331c-97df-83397230b0df
)
[name] => Eminem
[sort-name] => Eminem
[gender] => male
[country] => US
[area] => SimpleXMLElement Object
(
[@attributes] => Array
(
[id] => 489ce91b-6658-3307-9877-795b68554c98
[type] => Country
[type-id] => 06dd0ae4-8c74-30bb-b43d-95dcedf961de
)
[name] => United States
[sort-name] => United States
[life-span] => SimpleXMLElement Object
(
[ended] => false
)
)
Now when I echo the artist name as per below I get no output
<?php
ini_set('user_agent', 'MyApp/1.0 ([email protected])') ;
$xml = simplexml_load_file('http://musicbrainz.org/ws/2/artist/?query=artist:eminem');
//print_r($xml);
echo $xml->artist->name;
?>
Please can you explain what I am doing wrong I cannot seem to get any values from the xml result
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…