ShoutCast Playlist Problems – Resolved

Was checking over the auto-generated playlists earlier and noticed they wasn’t getting updated correctly from the cronjob this morning.

Then, had a look over the PHP logs and noticed it was complaining about “allow_url_include = 0” which wasn’t allowing:

To execute and parse the stations returned playlists, and in turn stopped all the playlist creation. Simple fix to this problem was to keep the insecure allow_url_include disabled and switch to CURL for grabbing the playlist, then save it to disk and delete, after the ini file was loaded.
So it looks something like this now:

Another, simple addition was the function to download the file to disk using CURL:

Might be a better way to do this, but for now it works and parses the ini files correctly, without making the server insecure by enabling allow_url_include. Was a very bad idea to allow that feature in PHP to begin with, the possibility of code excution without unsanitized input would have been really easy, and left the server insecure as a whole. So never take the quick and lazy or inexperienced route and look at alternatives. Especially when it involves webservers.

Playlists creation should be working as intended again, but give it a bit of time to finish the cronjob. I add a sleep between most queries to the ShoutCast servers to avoid getting temp bans from too many queries in a short space, so playlists creation can take some time. Just keep checking for a later version of the playlist than “1476013698” from here.

Edit..
Playlists are working as intended again with the cronjob finished.