![]() |
#1 |
Junior Member
Join Date: Jan 2009
Posts: 4
|
Easy PHP stats grab for Shoutcast DNAS 2
Hi guys,
Sometimes you just want the individual data from the shoutcast server. As I'm not an XML/PHP guru, it took me a long time to figure out how to do this! Posting it here as I think other people might find it useful. The below code will give you the current listener count for your station; code: You should be able to replace CURRENTLISTENERS with any of the variables from the wiki; http://wiki.winamp.com/wiki/SHOUTcas...Server_Summary Cheers, Kreza |
![]() |
![]() |
#2 |
Major Dude
|
Thats a really nice simple way of doing it
![]() We've also built a free PHP class to do this on github, it also handles SHOUTcast v1 servers too. Plus rumour has it that the next version of the DNAS supports JSON which will completely eliminate the need for PHP allowing you to request stats client-side from the users browser using jQuery! https://github.com/Wavestreaming/SHOUTcast-PHP-Class https://github.com/Wavestreaming/jquery-shoutcast |
![]() |
![]() |
#3 |
Junior Member
Join Date: Jul 2014
Posts: 2
|
PHP stats grab for Shoutcast DNAS 1 ?
I'm searching for long time a simple way to extract the shoutcast status data.
Thank you kreza for this simple code that working well. I would like to know how I can use this method for SHOUTcast DNAS v.1 ? I tried to use your code for shoutcast v.1 but as expected, does not work. It gives me an error: Warning: simplexml_load_file () [function.simplexml-load-file]: I / O warning: failed to load external entity "http% 3A% 2F% 2F94.23.8.191% 3A8888% 2Fstats% 3Fsid% 3D1 "in /xxxx/xxx/public_html /xxxx/status/shoutcast-conf.php on line 7 This line is: $sc_stats = simplexml_load_file($nice_url); Any help is welcome. Thanks |
![]() |
![]() |
#4 |
Join Date: Sep 2003
Posts: 27,873
|
you really should just be using a v2.x DNAS than trying to hack things to work on the unsupported v1.x DNAS as you can get at the stats with properly documented API methods with the v2.x DNAS.
|
![]() |
![]() |
#5 | |
Junior Member
Join Date: Dec 2011
Posts: 7
|
Quote:
code: |
|
![]() |
![]() |
#6 |
Join Date: Sep 2003
Posts: 27,873
|
seriously? scraping the page? even the v1.x DNAS has means to get the stats without doing that sort of heinous method above *shudders*
|
![]() |
![]() |
#7 |
Junior Member
Join Date: Jul 2014
Posts: 2
|
I tried your code, Colin2 but I have an error:
Warning: file_get_contents(http://94.23.8.191:8888/) [function.file-get-contents]: failed to open stream: Connection refused in /xxx/xxx/public_html/xxx/status/xxx-conf.php on line 5 0 |
![]() |
![]() |
#8 | |
Member
Join Date: Apr 2018
Posts: 60
|
How can we us this code to get the UNIQUELISTENERS for multiple streams ?
Quote:
|
|
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|