dustyfoo Posted May 1, 2015 Share Posted May 1, 2015 I am using php to show last 12 tracks what were played on a radio station, the existing script works, however, I need to modify it so it only shows last 12 results from lines what contain '/stream': example of playlist.log 01/May/2015:11:45:44 +0000|/live|0|Dense & Pika - Black Deep 01/May/2015:11:45:44 +0000|/stream|11|Dense & Pika - Black Deep 01/May/2015:11:45:48 +0000|/stream|11|DJ Mays - Big Room Session Mix (#111,112 TRTM) 01/May/2015:11:46:00 +0000|/live|0|Dense & Pika - Black Deep 01/May/2015:11:46:00 +0000|/stream|11|Dense & Pika - Black Deep 01/May/2015:11:46:05 +0000|/stream|11|DJ Mays - Big Room Session Mix (#111,112 TRTM) here is the existing script: http://dpaste.com/05XYG7G.txt Hope you can help Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted May 1, 2015 Share Posted May 1, 2015 Try changing these lines while (! feof($fp)) { $parts = fgetcsv($fp, 0, '|'); echo fgets($page). "<br />"; if (count($parts) !== 4) { continue; } to while (($parts = fgetcsv($fp, 0, '|')) !== FALSE) { if ((count($parts) != 4) || (strpos($parts[1], '/stream') === false)) { continue; } Quote Link to comment Share on other sites More sharing options...
dustyfoo Posted May 1, 2015 Author Share Posted May 1, 2015 You star!! It works perfectly, spent whole day trying to figure that out THANK YOU Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.