Hallo Experten!
Ich habe seit einiger Zeit ein PHP Script auf meiner Homepage am laufen welches mir die Titel meines Shoutcastservers abfrägt.
Nun habe ich den Server/Hoster gewechselt und das Script verursacht mir einen Fehler:
"Warning: fsockopen() [function.fsockopen]: unable to connect to xxx.xxx.xxx.xxx:8000 (Connection timed out) in /public_html/shoutc.php on line 28".
Laut Zeile 28 wäre der Server Offline, ist er aber nicht.
Irgendwie wird die Abfrage per fsockopen nicht erledigt

"allow_url_fopen" ist am Server ON (php version ist 5.2.10 / Server API - CGI/FastCGI)
Momentan läuft mein alter Server noch und dort funktioniert das Script nach wie vor einwandfrei.
Was könnte ich den Hoster denn eventuell bitten bzw. fragen was noch aktiviert sein muß damit das Script wieder funktioniert?
DANKE!
PHP-Code:
<?php
/*
// Author: dstjohn (Mediacast1/Casterclub)
// Date started: 05-03-2002 (10:00A.M)
// Date Ended: 05-03-2002 (6:03 P.M)
// Requirements:
// 1.SHOUTcast streaming server
// 2.Oddcast dsp with winamp/xmms (recomended setup)
// 3.Webserver with php 4.x (Recommended environment: Unix (Freebsd, Red Hat etc.. with Apache 3.x)
// Support: None, post in the casterclub forums
// Core script Information:
// SHOUTcast Song Status was written and developed on Windows Xp with apache and php4.1.2
// Has not been tested on IIs webservers, if you do so and get it to work please let us know
// At the forums (http://casterclub.com/forums)
// Also has been tested on freebsd with apache, php4.1.2 and works fine.
*/
//connect to shoutcast server
//Configuration ALT
$scdef = "Radiostation"; // Default station name to display when server or stream is down
$scip = "xxx.xxx.xxx.xxx"; // ip or url of shoutcast server
$scport = "xxxxx"; // port of shoutcast server
$scpass = "xxxx"; // password to shoutcast server
//End configuration
// include('http://www.lupo24.net/site2/myphpfiles/config.php'); //you may edit this path to fit your server environment otherwise leave it alone
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
//for newer shoutcast servers
fputs ($scfp, "GET /admin.cgi?mode=viewxml HTTP/1.1\r
Host: $scip:$scport\r
.
User-Agent: SHOUTcast Song (author: dstjohn@mediacast1.com)(Mozilla Compatible)\r
.
Authorization: Basic ".base64_encode ("admin:$scpass")."\r
\r
");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE)
$$scphp = urldecode($$scphp);
// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("</SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
//format the date
$frmt_date[$t] = date('l dS of F Y h:i:s A',$playedat[$t]);
//you may edit the html below, make sure to keep variables intact
echo'- '.$song[$t].'<BR>';
//echo'<b>'.$t.'.</b>Song: '.$song[$t].' - <b>Played @</b> '.$frmt_date[$t].'<BR>';
$r++;
}
fclose($scfp);
}
?>