Hallo liebe Freunde der Community,
ich habe mal wieder ein Problem :) in Bezug auf PHP, ich arbeite grad daran eine XML Ausgabe hinzubekommen, "SHOUTcast Transcoder" leider verstehe ich es mal wieder nur zum Teil.
Ich nutze die API von Shoutcast möchte gerne alle DJ's ausgeben lassen leider kommt nur eine Weiße Seite...
Die XML sollte folgendes zurück werfen:
http://wiki.winamp.com/wiki/SHOUTcas...cation#ListDJS
Code:
<djlist>
<dj>
<name/>
<password/>
<priority/>
<enabled/>
<banned>
<year/>
<month/>
<day/>
<hour/>
<minute/>
<second/>
</banned>
</dj>
<dj> ... </dj>
<dj .... </dj>
</djlist>
PHP Code:
PHP-Code:
<?php
error_reporting(E_ALL);
function sct_get_djlist()
{
$sc_host = 'XXXX';
$sc_port = '0000';
$sc_user = 'admin';
$sc_pass = 'XXXX';
mt_srand((double)microtime()*1000000);
$seq = mt_rand(1,100);
$post = 'op=listdjs&seq=' . $seq;
$ch = curl_init($sc_host . '/api');
curl_setopt($ch, CURLOPT_PORT, $sc_port);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $sc_user . ':' . $sc_pass);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$curl = curl_exec($ch);
$xml = new SimpleXMLElement($curl);
curl_close($ch);
if ($xml->djlist)
{
return (string)$xml->djlist->dj->name;
}
else
{
return 'Fehler';
}
}
echo sct_get_djlist();
?>
Ich hoffe jemand kann mir ein Ansatz geben wie ich zur Lösung kommen
Gruß