content retrieval from mp3.com band pages - need help

From: Date: Wed, 07 Feb 2001 20:01:57 +0000
Subject: content retrieval from mp3.com band pages - need help
Groups: php.general 
Request: Send a blank email to php-general+get-38610@lists.php.net to get a copy of this message
Ok, I'm new to programming in PHP. What I'm trying to do is retrieve the song list with play links off of my bands' page at Mp3.com. Ultimately I want to build it into a function I can call with an array of song names and it will return the html formatted as I like So far, I've used this code to open the page and get the part of the code with the song links in it: ----------------------------------------------------------- <? $url="http://artists.mp3s.com/artists/66/wildcraft.html"; $lines_array=file($url); $lines_string = implode('', $lines_array); eregi('<!----Playlist---->(.*)<!----Playlist Controls 2---->',$lines_string, $out); ?> -------------------------------------------------------------------------------- Now, I want to take $out[0], and delete all of the special mp3.com stuff like "Add to my mp3.com" and things like that. Basically, I've been trying to take the chunk of code, which repeats for each song, and replace it with code that just closes the tables and prepares for the next entry. This is the line I've tried: echo eregi_replace('<td><phrase><a href="http://my.mp3.com(.*)</tr></table>', '</td><td nowrap></td></tr></table></td>',$out[0]); What happens though is it takes the chuck out of the first occurance, and then prints the rest of the page unchanged. I want to do further formatting to the code after I remove these chunks though, such as replacing the img reference links and such. I'm starting to think I'm going about it wrong in the first place. I'm thinking I should just pull out the m3u and mp3 links, and use them within my own formatted page. It also occured to me to go through $lines_array line by line turning printing on and off with a flag. But the script is already fairly slow and even though I'm going to put it into a frame, I don't want it to take for ever to run. Anyway, if anyone has any suggestions or wants to help me develop this script, I could really use some help because I'm stuck right now. Thanks, max mysterioz@freakzone.org

« previous php.general (#38610) next »