I am using the iTunes API.
And I need to grab the image to parse into our php.
ok.
-
this is from the itunes XML
<image height="55">http://a5.mzstatic.com/us/r1000/078/Music/3c/40/58/mzi.ryeiepvk.55x55-70.jpg</image> <image height="60">http://a4.mzstatic.com/us/r1000/078/Music/3c/40/58/mzi.ryeiepvk.60x60-50.jpg</image> <image height="170">http://a3.mzstatic.com/us/r1000/078/Music/3c/40/58/mzi.ryeiepvk.170x170-75.jpg</image>
Now I have this in my PHP.
$image=$songinfo->image;
echo "<li>
<img class='minivideo-img' src=",$image,">
This works great, but its NOT pulling in the image I want its defaulting to the smallest.
I need to grab the image that is in the xml like:
<image height="170">
When I inspect my html i see this:
<img class="minivideo-img" src="http://a5.mzstatic.com/us/r1000/078/Music/3c/40/58/mzi.ryeiepvk.55x55-70.jpg">
I need to get this:
<img class="minivideo-img" src="http://a3.mzstatic.com/us/r1000/078/Music/3c/40/58/mzi.ryeiepvk.170x170-75.jpg">
Your sample code needs to retrieve the attribute from image node from the XML (in this case,
$mysongs). Since$songinfo->imageappears to be the image URL, theheightattribute should be$songinfo->image['height']Simple XML
Update: Now that you have updated your question, you appear to have multiple
imagenodes. You need to loop through them something like this:(Also updated to use the simpler attribute notation.)
You know, that link to thinkvitamin.com already had all you needed to know.