Retrieve track artist, title and artwork from a Shoutcast server.
##Config
Before you use shoutcast-php you will need to fill in your config.json
file with the correct information.
The shoutcast URL will need to include the port as well, such as http://example.com:8000
. Most Shoutcast servers use stream ID 1 as the default so shoutcast_stream
is set to that as default.
You will need to register with the last.fm API before you begin using shoutcast-php. Once you have done that you can fill in your last_fm_api_key
and last_fm_api_secret
.
{
"settings": {
"shoutcast_url": "",
"shoutcast_stream": 1,
"last_fm_api_key": "",
"last_fm_api_secret": ""
}
}
After you have done that all you need to do is copy these files to your web server as they are and then access shoutcast.php
as you need to do so.
I would recommend using an AJAX call to fetch the output from shoutcast.php
once every 5 seconds or so, and then parsing that as you wish.
If everything is working you should see something similar to the following:
{"artist":"Mass Effect","track":"A Rude Awakening","artwork":"https:\/\/lastfm-img2.akamaized.net\/i\/u\/97f596f9dace42b98269627eb35750c1.png"}