[RADIO] PHP Now Playing scripts heel traag.
Sinds een paar dagen loopt mijn site helemaal vast omdat de Now Playing scripts niet meer werken. Ik heb 3 stuks op de site. 1 Voor DJ ON AIR. 1 Voor Laatste tracks. 1 Voor TRACK ON AIR.
Maar het doet heel traag en het werkt zelfs niet.
http://procesradio.nl/includes/djonair.php
includes/djonair.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?
$radiohost='IP'; // the ip address of which you use to connect to the server
$radioport='PORT'; // The port the radio uses
$radioofflinemsg='Radio is offline'; // This message will be displayed if the server is offline
$radiopassword='PASS'; // Insert the DJ password to connect to the server
error_reporting(0);
$timeout='6';
$listenlink='http://'.$radiohost.':'.$radioport.'/listen.pls';
$radio=fsockopen("$radiohost", $radioport, &$errno, &$errstr, $timeout);
if(!$radio){
$success='2';
echo $radioofflinemsg; // Radio is offline, so display message
die();
}
//Connect to the server
if($success!='2'){ //If Connection
fputs($radio,"Get /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //Get 7.HTML
while(!feof($radio)){
$page.=fgets($radio, 1000);
}
$page=ereg_replace(".*<body>", "", $page);
$page=ereg_replace("</body>.*", ",", $page);
$numbers=explode(",",$page);
$currentlisteners=$numbers[0];
$connected=$numbers[1];
//Open Connection
$fp=fsockopen("$radiohost", $radioport, &$errno, &$errstr, 3);
if(!$fp){ //If Connection
$success2='2';
echo "Radio is offline";
}
if($success2!='2'){ //If Connected
fputs($fp,"Get /admin.cgi?pass=$radiopassword&mode=viewxml HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
while(!feof($fp)){
$page.= fgets($fp, 1000);
}
$security=explode(",",$page);
$security=explode("401",$security[7]);
$u='0';
while($security[$u]!=""){
if($security[1]!=''){
die("Incorrect Server Password");
}
$u++;
}
//Array
$loop=array("AVERAGETIME", "SERVERGENRE", "SERVERURL", "SERVERTITLE", "SONGTITLE", "SONGURL", "IRC", "ICQ", "AIM", "WEBHITS", "STREAMHITS", "INDEX", "LISTEN", "PALM7",
"LOGIN", "LOGINFAIL", "PLAYED", "COOKIE", "ADMIN", "UPDINFO", "KICKSRC", "KICKDST", "UNBANDST", "BANDST", "VIEWBAN", "UNRIPDST", "VIEWRIP", "VIEWXML",
"VIEWLOG", "INVALID"); //Define All The Variables To Get (Delete Any Ones You Don't Want)
$y='0';
while($loop[$y]!=''){
$pageed=ereg_replace(".*<$loop[$y]>", "", $page); //Extract Data
$phpname=strtolower($loop[$y]);
$$phpname=ereg_replace("</$loop[$y]>.*", "", $pageed); //Finish Extracting Data
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE)
$$phpname=urldecode($$phpname);
$phpname = $phpname;
$y++;
}
}
if($connected=='1')
$wordconnected="yes";
else
$wordconnected="no";
$peaklisteners=$numbers[2];
$maxlisteners=$numbers[3];
$reportedlisteners=$numbers[4];
$song=$numbers[6];
$bitrate=$numbers[5];
$site=explode(" ", $servertitle);
$title=explode("DJ",$servertitle);
if($wordconnected=="no" && $connected=="0")
{
echo $radioofflinemsg;
}else{
echo"$servertitle";
//Close Connection
fclose($radio);
}
}
/////////////////////////////////////////////////////////////////////////////
# Atomic Network Productions #
/////////////////////////////////////////////////////////////////////////////
?>
$radiohost='IP'; // the ip address of which you use to connect to the server
$radioport='PORT'; // The port the radio uses
$radioofflinemsg='Radio is offline'; // This message will be displayed if the server is offline
$radiopassword='PASS'; // Insert the DJ password to connect to the server
error_reporting(0);
$timeout='6';
$listenlink='http://'.$radiohost.':'.$radioport.'/listen.pls';
$radio=fsockopen("$radiohost", $radioport, &$errno, &$errstr, $timeout);
if(!$radio){
$success='2';
echo $radioofflinemsg; // Radio is offline, so display message
die();
}
//Connect to the server
if($success!='2'){ //If Connection
fputs($radio,"Get /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //Get 7.HTML
while(!feof($radio)){
$page.=fgets($radio, 1000);
}
$page=ereg_replace(".*<body>", "", $page);
$page=ereg_replace("</body>.*", ",", $page);
$numbers=explode(",",$page);
$currentlisteners=$numbers[0];
$connected=$numbers[1];
//Open Connection
$fp=fsockopen("$radiohost", $radioport, &$errno, &$errstr, 3);
if(!$fp){ //If Connection
$success2='2';
echo "Radio is offline";
}
if($success2!='2'){ //If Connected
fputs($fp,"Get /admin.cgi?pass=$radiopassword&mode=viewxml HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
while(!feof($fp)){
$page.= fgets($fp, 1000);
}
$security=explode(",",$page);
$security=explode("401",$security[7]);
$u='0';
while($security[$u]!=""){
if($security[1]!=''){
die("Incorrect Server Password");
}
$u++;
}
//Array
$loop=array("AVERAGETIME", "SERVERGENRE", "SERVERURL", "SERVERTITLE", "SONGTITLE", "SONGURL", "IRC", "ICQ", "AIM", "WEBHITS", "STREAMHITS", "INDEX", "LISTEN", "PALM7",
"LOGIN", "LOGINFAIL", "PLAYED", "COOKIE", "ADMIN", "UPDINFO", "KICKSRC", "KICKDST", "UNBANDST", "BANDST", "VIEWBAN", "UNRIPDST", "VIEWRIP", "VIEWXML",
"VIEWLOG", "INVALID"); //Define All The Variables To Get (Delete Any Ones You Don't Want)
$y='0';
while($loop[$y]!=''){
$pageed=ereg_replace(".*<$loop[$y]>", "", $page); //Extract Data
$phpname=strtolower($loop[$y]);
$$phpname=ereg_replace("</$loop[$y]>.*", "", $pageed); //Finish Extracting Data
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE)
$$phpname=urldecode($$phpname);
$phpname = $phpname;
$y++;
}
}
if($connected=='1')
$wordconnected="yes";
else
$wordconnected="no";
$peaklisteners=$numbers[2];
$maxlisteners=$numbers[3];
$reportedlisteners=$numbers[4];
$song=$numbers[6];
$bitrate=$numbers[5];
$site=explode(" ", $servertitle);
$title=explode("DJ",$servertitle);
if($wordconnected=="no" && $connected=="0")
{
echo $radioofflinemsg;
}else{
echo"$servertitle";
//Close Connection
fclose($radio);
}
}
/////////////////////////////////////////////////////////////////////////////
# Atomic Network Productions #
/////////////////////////////////////////////////////////////////////////////
?>
Gewijzigd op 01/01/1970 01:00:00 door EricW.
Wat is nu je probleem? Dat je scripts het niet meer doen? Wat gaat er fout dan?
is dit een live radio stream?