een php script wat eerder wel werkte maar nu niet meer
// de header, hij refreshed de pagina na zoveel seconden,
// de URL is een optie hoef je niet te gebruiken dus.
header("Refresh: ".$s."; URL=".$u);
// $s = voor het aantal seconden ;
// $u = voor het bestand dat je wil openen;
// voorbeeld:
header("Refresh: 45; URL=http://www.radiodoremi.nl//radio-strats/radio_stats.php");
// deze refresh zal in 5 seconden deze pagina vervangen voor www.phphulp.nl
// Alle code dat achter de refresh staat wordt wel gedaan.
// tot de X aantal seconden voorbij zijn, dus:
echo('');
// dit word 45 seconden lang getoond en dan wordt u doorverbonden :D
?>
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
// Shoutcast Server Strats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.
// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.
// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!
include('config_radio.php');
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "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 || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);
// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//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]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
//end song info
fclose($scfp);
}
//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="" bgcolor="#000000">
<div style="position:absolute; top:7; left:2;">
<FONT size="3" face="arial" color="#FFFFFF">
<p align="center"><center>
<img src="online.jpg"><br>
<b>DJ:</b> '.$servertitle.'<br>
<b>LUISTERAARS:</b> '.$currentlisteners.'<br>
<b>U HOORT NU:</b> '.$song[0].'</p><b>
</p>
</body>
</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>Storing</title>
</head>
<body text="" bgcolor="black">
<center>
<img src="offline.jpg">
</body>
</html>';
}
?>
// Shoutcast Server Strats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.
// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.
// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!
include('config_radio.php');
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "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 || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);
// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//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]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
//end song info
fclose($scfp);
}
//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="" bgcolor="#000000">
<div style="position:absolute; top:7; left:2;">
<FONT size="3" face="arial" color="#FFFFFF">
<p align="center"><center>
<img src="online.jpg"><br>
<b>DJ:</b> '.$servertitle.'<br>
<b>LUISTERAARS:</b> '.$currentlisteners.'<br>
<b>U HOORT NU:</b> '.$song[0].'</p><b>
</p>
</body>
</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>Storing</title>
</head>
<body text="" bgcolor="black">
<center>
<img src="offline.jpg">
</body>
</html>';
}
?>
dit is het stukje wat de webhost mij stuurde
Net even gekeken en het script wat jij hebt is verouderd.
Wij hebben vanmorgen de php versie geupdate en daar wordt de Call-time niet meer ondersteund wat jij het beste kunt doen is op zoek gaan naar een versie van het script die php 5.4 ondersteund
ereg_replace()
Quote:
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
En ja, dat script heeft zijn 10-jarige jubileum intussen ook gevierd. Je zou eens kunnen kijken of er nieuwere alternatieven zijn om de Shoutcast status op te vragen.
de ereg-functies zijn wel deprecated, maar in 5.4 toch nog steeds functionerend?
Thomas van den Heuvel op 01/12/2015 10:40:10:
Uhm, hebben ze deze upgrade aangekondigd of zonder introductie de schakelaar omgegooid? In het laatste geval is dat nou niet bepaald netjes.
+1
dit krijg ik als melding
Fatal error: Call-time pass-by-reference has been removed in /home/radiodor/domains/radiodoremi.nl/public_html/radio-strats/radio_stats.php on line 35
Neemt niet weg dat, ook al lost dit je directe problemen op, je je script wat meer up-to-date zou moeten maken.
Toevoeging op 01/12/2015 14:20:30:
hey supper bedankt het werkt weer supper thomas van den heuvel bedankt voor de reactie
Toevoeging op 01/12/2015 14:27:42:
het reafressen van de script kan dat ook sneller gezet worden zoja waar in het script als ik vragen mag
Erwin sonex op 01/12/2015 01:06:35:
// $s = voor het aantal seconden ;