Jump to content

PHP and XML Question


Sleeper

Recommended Posts

Hello. I'm trying to pull information out of an xml file. However I'm a bit lost in getting the actual value.

 

$url="http://ws.audioscrobbler.com/2.0/?method=artist.getimages&artist=Dr%20Feelgood&limit=1&autocorrect=1&api_key=c107c9b5c09cb5693b6c19409dd984c1";

$xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); 

$largesquare=$xml->images->sizes->size[2];

 

Is what I have but its not pulling the information. The above url will give you the link to a set xml file for this example. And I want to get the info for the

 

<size name="largesquare" width="126" height="126">http://userserve-ak.last.fm/serve/126s/43173899.jpg</size>

 

I'm sure I'm doing something wrong that's a simple fix but I am lost here. In the sizes there are 6 different size options each with different names and I have no idea how to pull the one with the correct name that I need.

 

Thank you to who ever can help me sort this out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.