View Single Post
Old 22nd March 2011, 09:24   #15
MADxHAWK
Senior Member
 
Join Date: Jan 2010
Posts: 182
Hi,

sorry have missed this post :S

This script uses the phpCURL libary to connect to the shoutcast server. If you dont get any data maybe this lib is not installed on your server/webspace. Also most free webspacehoster dont allow external connections (like funpic for example).

Look for the line:
code:
$curl = curl_exec($ch);

after add:
code:
var_dump($curl)

This line will dump the data curl gets.


You can use this script with a shoutcast 1 also. you just have to change the line like jaromanda sugested. But you wont get all data from shoutcast 1. For example shoutcast 1 provided also webhits, admin logins and a few more data that shoutcast 2 doesnt.

To get an output you need this line for example: (sorry there was a typo in the example)
echo $dnas_data ['SONGTITLE'];

This line wont give you any output:
echo $xml->SONGTITLE;


A simple html file to get the current song and songhistory could look something like this:

current_song.php
code:

<html>
<head>
<title>Currently played song</title>
</head>
<body>
<?php include("/path/to/shoutcast.php"); ?>
welcome to my station <br />
<br />
Now playing: <?php echo $dnas_data['SONGTITLE']; ?><br />
<br />
Last played songs:<br />
<?php
foreach ($sc_data['SONGHISTORY'] as $song)
{
echo "[" . date('H:i', $song['PLAYEDAT']) . "] - " . $song['TITLE'] . "<br />;
}
?>
</body>
</html>



The file have to be named *.php NOT *.htm or *.html !! else the phpcode wont be parsed.

Maybe i will write a shoutcast class working where you can select weather to use curl or fsockopen for connection to shoutcast working with both versions of the DNAS.
MADxHAWK is offline   Reply With Quote