# Php calling XML Attribute

**URL:** <https://forum.kirupa.com/t/php-calling-xml-attribute/223949>\
**Category:** programming\
**Created:** [April 27, 2007, 1:16am UTC](https://forum.kirupa.com/t/php-calling-xml-attribute/223949 "2007-04-27T01:16:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaron\_kick](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/aaron_kick/32/3361_2.png) [@aaron\_kick](https://forum.kirupa.com/u/aaron_kick)\
**Post date:** [April 27, 2007, 1:16am UTC](https://forum.kirupa.com/t/php-calling-xml-attribute/223949/1 "2007-04-27T01:16:15Z")

</div>

Hey folks,

Basically I’m using a bit of php which converts the xml values into html.

This feed

[http://ws.audioscrobbler.com/1.0/artist/Metallica/fans.xml](http://ws.audioscrobbler.com/1.0/artist/Metallica/fans.xml)

I’m using simple statments such as **echo $element-\>weight;  
\*\*  
and  
\*\*  
echo $element-\>url;**

these work fine.

I’m trying to call the part ‘user username’ but because its an attribute and has a space, and none of these work.

\*\*echo $element-\>user;

\*\*\*\*echo $element-\>user username;

\*\ ***echo $element-\>username;**

Does anyone know what I need to do in this case ?

Any help is much appreciated, it’s been bugging me for a while now !

Thanks,

Aaron
