Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

fsockopen errors - Shoutcast Now Playing script

#1
[Solved]
Hi techies,

I'm trying to use a "Shoutcast Now Playing" script

which can be found here:
Code:
http://radiosolution.info/clients/knowledgebase/36/Now-playing-script-for-Shoutcast.html
and an example:
Code:
http://www.radiosolution.info/tools/nowplaying.php


now I'm having a problem with the same script on my site
Code:
http://noelborg.com/testing/stats/radio_stats.php

Do you allow connections via "fsockopen" ? Can I use such script, please?
username: noelpro
#2
[Solved]
You should be able to edit that in you php.ini I'm sure.
 
[Image: userbar.png]
[Image: polandbar4.gif]
#3
[Solved]
Depends on whether the connection is closed by default for security reasons. DJB or un4saken would be able to confirm whether it is closed.
#4
[Solved]
When I try to visit your site then the problem look appear like this.
Code:
Fatal error: Call-time pass-by-reference has been removed in /home/noelpro/public_html/testing/stats/radio_stats.php on line 16

It seem the problem is coming from line 16. I found other related article which is disscussing the problem like yours.

http://stackoverflow.com/questions/89712...-available.
HOT MUSIC VIDEO | Video Music Knowledgebase
#5
[Solved]
(04-27-2014, 03:45 AM)jaran Wrote: When I try to visit your site then the problem look appear like this.
Code:
Fatal error: Call-time pass-by-reference has been removed in /home/noelpro/public_html/testing/stats/radio_stats.php on line 16

It seem the problem is coming from line 16. I found other related article which is disscussing the problem like yours.

http://stackoverflow.com/questions/89712...-available.


I honestly have no idea what you're talking about. Didn't find that cose in the radio_stats,php.

This is the code I've got at present.

Code:
<?php
// Shoutcast Server Stats
// 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="">


<p align="center"><center>
<img src="online.jpg"><br>
<b>Stream Title:</b> '.$servertitle.'<br>
<b>Listeners:</b> '.$currentlisteners.' / '.$maxlisteners.'<br>
<b>Bitrate:</b> '.$bitrate.'kbps<br>
<b>Current Song:</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>Radio Server Is Offline</title>
</head>

<body text="" bgcolor="">
<center>
<img src="offline.jpg">
</body>

</html>';
}
?>
#6
[Solved]
You need to enable "fsockopen" in your php settings. I have website on gigarank that uses "fsockopen" and I have no problem with that, because it works perfect for me.
 
[Image: userbar.png]
[Image: polandbar4.gif]
#7
[Solved]
(04-27-2014, 07:58 AM)igdesigner Wrote: You need to enable "fsockopen" in your php settings. I have website on gigarank that uses "fsockopen" and I have no problem with that, because it works perfect for me.

Where do I find php.ini, can't find it anywhere in my cPanel/FileManager.

thanks mate.
#8
[Solved]
As I said before at above you had the error because "&" variable at line 16
Your script,
PHP Code:
$scfp fsockopen("$scip"$scport, &$errno, &$errstr30); 
It should be,
PHP Code:
$scfp fsockopen("$scip"$scport$errno$errstr30); 
HOT MUSIC VIDEO | Video Music Knowledgebase
[-] The following 1 user Likes jaran's post:
  • NoelF1
#9
[Solved]
(04-27-2014, 09:49 AM)NoelF1 Wrote:
(04-27-2014, 07:58 AM)igdesigner Wrote: You need to enable "fsockopen" in your php settings. I have website on gigarank that uses "fsockopen" and I have no problem with that, because it works perfect for me.

Where do I find php.ini, can't find it anywhere in my cPanel/FileManager.

thanks mate.

In your php.ini file you need to write this:

PHP Code:
allow_url_fopen On 

Also make sure that it is working create .htaccess file and pase this:

PHP Code:
Options +FollowSymLinks
RewriteEngine On 

Hope it helps.
 
[Image: userbar.png]
[Image: polandbar4.gif]
[-] The following 1 user Likes GigaGreg's post:
  • NoelF1
#10
[Solved]
(04-27-2014, 10:30 AM)igdesigner Wrote:
(04-27-2014, 09:49 AM)NoelF1 Wrote:
(04-27-2014, 07:58 AM)igdesigner Wrote: You need to enable "fsockopen" in your php settings. I have website on gigarank that uses "fsockopen" and I have no problem with that, because it works perfect for me.

Where do I find php.ini, can't find it anywhere in my cPanel/FileManager.

thanks mate.

In your php.ini file you need to write this:

PHP Code:
allow_url_fopen On 

Also make sure that it is working create .htaccess file and pase this:

PHP Code:
Options +FollowSymLinks
RewriteEngine On 

Hope it helps.

Thanks a lot mate, edited my .htaccess file. But I can't find my php.ini file anywhere. Undecided
#11
[Solved]
Ohh, just create one in your public_html :) using notepad ++ or similar program.
 
[Image: userbar.png]
[Image: polandbar4.gif]
[-] The following 1 user Likes GigaGreg's post:
  • NoelF1
#12
[Solved]
(04-27-2014, 10:21 AM)jaran Wrote: As I said before at above you had the error because "&" variable at line 16
Your script,
PHP Code:
$scfp fsockopen("$scip"$scport, &$errno, &$errstr30); 
It should be,
PHP Code:
$scfp fsockopen("$scip"$scport$errno$errstr30); 

Thanks a lot Jaran, seems like half of the problem is solved.

but now I still got the fsockopen error. I still can't find my php.ini anywhere and don't know how I am going to enable the thing. :/
I've done a phpinfo page though.
Code:
http://noelborg.com/testing/phpinfo.php

Code:
Warning: fsockopen(): unable to connect to free-shoutcast.com:18536 (Connection timed out) in /home/noelpro/public_html/testing/stats/radio_stats.php on line 16
NoelBorg.com // Radio is Offline

Code:
http://noelborg.com/testing/stats/radio_stats.php

(04-27-2014, 11:22 AM)igdesigner Wrote: Ohh, just create one in your public_html :) using notepad ++ or similar program.

Just created one.

added the following code only;

Code:
allow_url_fopen = On

Still ain't working Sad:sorry
#13
[Solved]
I have no idea then, wait for DJB or Un4saken Sad
 
[Image: userbar.png]
[Image: polandbar4.gif]
#14
[Solved]
(04-27-2014, 11:53 AM)igdesigner Wrote: I have no idea then, wait for DJB or Un4saken Sad
Thanks for the help though ! :)

Hopefully either one of the techie's will help me fix it :)
#15
[Solved]
(04-27-2014, 11:27 AM)NoelF1 Wrote:
(04-27-2014, 10:21 AM)jaran Wrote: As I said before at above you had the error because "&" variable at line 16
Your script,
PHP Code:
$scfp fsockopen("$scip"$scport, &$errno, &$errstr30); 
It should be,
PHP Code:
$scfp fsockopen("$scip"$scport$errno$errstr30); 

Thanks a lot Jaran, seems like half of the problem is solved.

but now I still got the fsockopen error. I still can't find my php.ini anywhere and don't know how I am going to enable the thing. :/
I've done a phpinfo page though.
Code:
http://noelborg.com/testing/phpinfo.php

Code:
Warning: fsockopen(): unable to connect to free-shoutcast.com:18536 (Connection timed out) in /home/noelpro/public_html/testing/stats/radio_stats.php on line 16
NoelBorg.com // Radio is Offline

Code:
http://noelborg.com/testing/stats/radio_stats.php

(04-27-2014, 11:22 AM)igdesigner Wrote: Ohh, just create one in your public_html :) using notepad ++ or similar program.

Just created one.

added the following code only;

Code:
allow_url_fopen = On

Still ain't working Sad:sorry

Again, the problem is not coming from the hosting. To remove all error reporting, you can add this code at the top of line.
PHP Code:
ini_set('display_errors','OFF');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
ini_set('max_execution_time'300); //300 seconds = 5 minutes

//YOUR SCRIPT....... 
HOT MUSIC VIDEO | Video Music Knowledgebase
[-] The following 2 users Like jaran's post:
  • DJB, NoelF1
#16
[Solved]
(04-28-2014, 12:52 AM)jaran Wrote:
(04-27-2014, 11:27 AM)NoelF1 Wrote:
(04-27-2014, 10:21 AM)jaran Wrote: As I said before at above you had the error because "&" variable at line 16
Your script,
PHP Code:
$scfp fsockopen("$scip"$scport, &$errno, &$errstr30); 
It should be,
PHP Code:
$scfp fsockopen("$scip"$scport$errno$errstr30); 

Thanks a lot Jaran, seems like half of the problem is solved.

but now I still got the fsockopen error. I still can't find my php.ini anywhere and don't know how I am going to enable the thing. :/
I've done a phpinfo page though.
Code:
http://noelborg.com/testing/phpinfo.php

Code:
Warning: fsockopen(): unable to connect to free-shoutcast.com:18536 (Connection timed out) in /home/noelpro/public_html/testing/stats/radio_stats.php on line 16
NoelBorg.com // Radio is Offline

Code:
http://noelborg.com/testing/stats/radio_stats.php

(04-27-2014, 11:22 AM)igdesigner Wrote: Ohh, just create one in your public_html :) using notepad ++ or similar program.

Just created one.

added the following code only;

Code:
allow_url_fopen = On

Still ain't working Sad:sorry

Again, the problem is not coming from the hosting. To remove all error reporting, you can add this code at the top of line.
PHP Code:
ini_set('display_errors','OFF');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
ini_set('max_execution_time'300); //300 seconds = 5 minutes

//YOUR SCRIPT....... 

Superb help Jaran ! Finally that line 16 error is gone !
But the script still ain't working... all I see is radio is offline... no image no nothing... even when the server is on Sad ...this getting to be tedious to set up... :/
#17
[Solved]
@NoelF1

I think you should ask it with your radio station. Maybe your port is wrong or missing something configuration.
HOT MUSIC VIDEO | Video Music Knowledgebase
#18
[Solved]
(04-28-2014, 09:50 AM)jaran Wrote: @NoelF1

I think you should ask it with your radio station. Maybe your port is wrong or missing something configuration.

Well my script config file has the ip, port and password all good. So the config should be good.
I think it's something to do with the script. Although I've managed to get the script working before without all this mess.
#19
[Solved]
(04-28-2014, 10:23 AM)NoelF1 Wrote:
(04-28-2014, 09:50 AM)jaran Wrote: @NoelF1

I think you should ask it with your radio station. Maybe your port is wrong or missing something configuration.

Well my script config file has the ip, port and password all good. So the config should be good.
I think it's something to do with the script. Although I've managed to get the script working before without all this mess.

I have no experienced with shoutcast configuration. But I have other link maybe you would test it for your project. Its using jquery for configuration.

https://github.com/Wavestreaming/jquery-shoutcast
HOT MUSIC VIDEO | Video Music Knowledgebase
#20
[Solved]
Fixed yessir
Please do not email or PM me with private support requests - Use Support Section.
Don't forget to read TOS.
Never argue with idiots.
First, they'll bring you down to their level and then beat you with their experience!
[-] The following 2 users Like un4saken's post:
  • Genesis, NoelF1
  




Users browsing this thread:
1 Guest(s)

fsockopen errors - Shoutcast Now Playing script462