Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Anyone sh*t hot with xml and php
422
MVP
I am grabbing itunes api, and using simplexml to loop thru the xml page to grab songs, titles and...... Bloody images.
Struggling on the image bit, i need help asap. Can fire up private demo if you can help.
Email me at sales@vanillaskins.com cheers
There was an error rendering this rich post.
0
Best Answer
-
UnderDog MVP
Did you look which information you get in $songinfo ? Are you sure there are 2 images sent? The smaller and the bigger one? if you use print_r($songinfo) you can see what the array contains. if you put it in between
< pre >< /pre >
tags you (hopefully) see a better readable array.
If you want to work on the empty ul's and li's just let us know. It has also something to do with the arrays you get from simplexml and chart.xml
There was an error rendering this rich post.
0
Answers
One thing to note that SimpleXml loads the entire file into memory. Not a big deal if the file is small, but if it's huge your script will die. I've had to use a combination of the
XmlReader
and SimpleXml to parse big files.Yer read that it hogs memory and can crap itself, max xml file is 45kb. But as we cron it we will strip out all the crap, and rename to new xml file.
Ive never played with xml, and so big learning curve
There was an error rendering this rich post.
Ok I fixed the main issue, which was grabbing the images.
For some reason, within a ul li php loop, we are getting extraneous and empty lis, at the top of the list. Weird but will iron that out later.
The issue now, is itunes xml gives you three image files per track, sized using php. But individually linked.
So in my xml I have:
In my php I have this:
The issue is when the script loops thru it is grabbing the SMALLEST image, from the xml ( presumably default ) I just dont know how to tell php to grab the bigger one. the 175x175 version
There was an error rendering this rich post.
Arggh frikken markdown. http://pastebin.com/7YsSEGX6
There was an error rendering this rich post.
Did you look which information you get in $songinfo ? Are you sure there are 2 images sent? The smaller and the bigger one? if you use print_r($songinfo) you can see what the array contains. if you put it in between
tags you (hopefully) see a better readable array.
If you want to work on the empty ul's and li's just let us know. It has also something to do with the arrays you get from simplexml and chart.xml
There was an error rendering this rich post.
Cheers mate, sweet sorted it thankyou.
There was an error rendering this rich post.