function.fsockopen alweer
Ik heb al een .htaces file gemaakt met de regel php_value allow_call_time_pass_reference 1
Niets lijkt te werken Kan iemand vertelen wat ik nu nog kan doen om dit te verhelpen?
ook de reactie van het hosting bv is dit
Geachte heer/mevrouw,
U kunt zonder probleem de fsockopen functie in PHP gebruiken op onze servers.
Met vriendelijke groeten,
vrg Danny
Gewijzigd op 01/01/1970 01:00:00 door Danny
Dan ligt het waarschijnlijk aan je code.
Gebruik je de fsockopen functie in je scripts?
Ja die gebruik ik ook in mijn scripts.
Dan zal er wel iets mis zijn met de gegevens die je meegeeft met deze functie. Als je host al aangeeft dat je gebruik kunt maken van de functie, zal hij verder geen errors opleveren m.b.t. het uitvoeren. Wel met m.b.t. de meegegeven parameters.
iemand nog ideeen ??
ik post wel even een simple scriptje hier gaat het al mis mee.
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
117
118
119
120
121
122
123
124
125
126
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
117
118
119
120
121
122
123
124
125
126
<?php
//*********** PUT YOUR INFO HERE ***********//
//Configuration
$scdef = "His";
// ABOVE: Default station name to display when server or stream is down
$scip = "213.93.59.2"; // ip or url of shoutcast server (DO NOT ADD HTTP:// don't include the port)
$scport = "4663"; // port of shoutcast server
$scpass = "552960"; // password to shoutcast server
$refreshrate = "60"; // Script/Page refresh time
$bgcolor = "#E1EBEA"; // page background colour, hex value, default = white, #ffffff
//End configuration
//*********** PUT YOUR INFO HERE ***********//
$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");
$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 name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="'.$refreshrate.';URL=/last.php">
<link href="main.css" type="text/css" rel="stylesheet" />
<title>'.$scdef.'</title>
</head>
<body text="" style="background-color:">
<br />
</center>
<span class="boldtype2"><p><b>Song History</b></span>
<br><br>
01. <span class="boldtype3">'.$song[1].'</span><br>
02. <span class="boldtype3">'.$song[2].'</span><br>
03. <span class="boldtype3">'.$song[3].'</span><br>
04. <span class="boldtype3">'.$song[4].'</span><br>
05. <span class="boldtype3">'.$song[5].'</span><br>
06. <span class="boldtype3">'.$song[6].'</span><br>
07. <span class="boldtype3">'.$song[7].'</span><br>
08. <span class="boldtype3">'.$song[8].'</span><br>
09. <span class="boldtype3">'.$song[9].'</span><br>
10. <span class="boldtype3">'.$song[10].'</span><br>
</body>
</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="'.$refreshrate.';URL=last.php">
<link href="main.css" type="text/css" rel="stylesheet" />
<title>Server Offline</title>
</head>
<body text="" style="background-color:">
<span class="playdisplay"><b>Server Offline or Server maintenance</b> <img border="0" src="/Radiowinamp.gif"></span>
<br>Please try again later.........
</body>
</html>';
}
?>
//*********** PUT YOUR INFO HERE ***********//
//Configuration
$scdef = "His";
// ABOVE: Default station name to display when server or stream is down
$scip = "213.93.59.2"; // ip or url of shoutcast server (DO NOT ADD HTTP:// don't include the port)
$scport = "4663"; // port of shoutcast server
$scpass = "552960"; // password to shoutcast server
$refreshrate = "60"; // Script/Page refresh time
$bgcolor = "#E1EBEA"; // page background colour, hex value, default = white, #ffffff
//End configuration
//*********** PUT YOUR INFO HERE ***********//
$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");
$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 name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="'.$refreshrate.';URL=/last.php">
<link href="main.css" type="text/css" rel="stylesheet" />
<title>'.$scdef.'</title>
</head>
<body text="" style="background-color:">
<br />
</center>
<span class="boldtype2"><p><b>Song History</b></span>
<br><br>
01. <span class="boldtype3">'.$song[1].'</span><br>
02. <span class="boldtype3">'.$song[2].'</span><br>
03. <span class="boldtype3">'.$song[3].'</span><br>
04. <span class="boldtype3">'.$song[4].'</span><br>
05. <span class="boldtype3">'.$song[5].'</span><br>
06. <span class="boldtype3">'.$song[6].'</span><br>
07. <span class="boldtype3">'.$song[7].'</span><br>
08. <span class="boldtype3">'.$song[8].'</span><br>
09. <span class="boldtype3">'.$song[9].'</span><br>
10. <span class="boldtype3">'.$song[10].'</span><br>
</body>
</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="'.$refreshrate.';URL=last.php">
<link href="main.css" type="text/css" rel="stylesheet" />
<title>Server Offline</title>
</head>
<body text="" style="background-color:">
<span class="playdisplay"><b>Server Offline or Server maintenance</b> <img border="0" src="/Radiowinamp.gif"></span>
<br>Please try again later.........
</body>
</html>';
}
?>
Gewijzigd op 01/01/1970 01:00:00 door danny
Quote:
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
En als je de quotes daar weghaalt? Die horen daar nl. al niet..
Ja, klopt. Maar krijg je nu geen fout meer dat fsockopen() niet zou werken?
Ik heb niet goed doorgelezen maar het is wel .htaccess (dubbel S en C) misschien helpt dat