Tweet

Ana Sayfa   Forum   PHP
Yeni Başlık Cevap Ekle
white_bullet İnternet radyoları için shoutCast server den bilgi getirme (10/06/2009 01:01)
profil Dia
 offline OFFLINE
 Sleepless Coder

İnternet radyosu kurmak isteyen arkadaşların ilgisini çekeceğini düşündüğüm bir scripti sizlerle paylaşmak istedim. eğer bir internet radyosu kuracaksanız sitenizin herhangi bir yerinde şuanda çalan şarkı - dinleyici sayısı şarkının kaç dakika süreceği gibi bilgilerin bulunmasını isteyebilirsiniz. işte vereceğim script tamda bu noktada işe yarıyor.

CODE:

// Generic config parameters

// Radio Station Name
$station_name = "";

// IP address (e.g. localhost)
$caster_ip = "";//insert ip or domain

// Port for the caster (e.g. 8000) Leave blank if u don't know what your doing.
$caster_port = ""; //insert broadcast port

// Caster type: shout or ice
$caster = "shout";

// Icecast config parameters

// If icecast is used with mount points else leave blank (e.g. /128)
$icecast_mount_point = "";

// .pls type play list.
$playlist_pls = "";

// .asx type play list. Looks like u need an asx type of play list for wmp if
// u run Icecast.
$playlist_asx = "";

// IP address of the server where the play lists are located. Leave blank if
// they are on the same server as the caster ip.
$playlist_ip = "";

// Port of the server where the play lists are located. Leave blank if they
// are on the same server as the caster ip.
$playlist_port = "";

// Advanced config parameters

// If both web server and icecast are behind a router and the web server needs
// to know the internal ip of caster so it can pull the info for the player.
// This could be the case if all three got different internal ip-s.
$caster_internal_ip = "";
$caster_internal_port = "";


$errno = "0";
$errstr = "";
$connect_timeout = "5";

$state = "";
$currentsong = "";
$currentlisteners = "";
$maxlisteners = "";
$mimetype = "";
$stream_genre = "";
$bitrate = "";
$peaklisteners = "";
$server_name = "";
$server_description = "";
$quality = "";
$video_quality = "";
$frame_size = "";
$frame_rate = "";
$server_url = "";
$artist = "";

if(empty($caster_internal_ip))
{
$shout_caster_ip = $caster_ip;
$shout_caster_port = $caster_port;
}
else
{
$shout_caster_ip = $caster_internal_ip;
$shout_caster_port = $caster_internal_port;
}

#error_reporting(0);
$fp = fsockopen($shout_caster_ip, $shout_caster_port, $errno, $errstr, 5);
if(!$fp)
{
$state = "Down";
}
else
{
fputs($fp,"GET /index.html HTTP/1.0rnUser-Agent: XML Getter (Mozilla Compatible)rnrn");
$page = "";
while(!feof($fp))
{
$page .= fgets($fp, 1000);
}
$page = ereg_replace(".*Server Status:", "", $page); //extract data
$page = ereg_replace("</b></td></tr></table><br>.*", "", $page); //extract data
$page_array = preg_split('~(</?[^>]+>)~' , $page, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if(count( $page_array ) > 10)
{
for( $i = 0; $i < count( $page_array ); $i++ )
{
$state = "Up";
if($page_array[$i] == "Stream Status: ")
{
$bitrate = ereg_replace(" kbps.*", "", ereg_replace(".*at ", "", $page_array[$i+6]));
$currentlisteners = ereg_replace("of.*", "", $page_array[$i+8]);
$maxlisteners = ereg_replace(" listeners.*", "", ereg_replace(".*of", "", $page_array[$i+8]));
}
if($page_array[$i] == "Listener Peak: ")
{
$peaklisteners = strip_tags($page_array[$i+6]);
}
if($page_array[$i] == "Content Type: ")
{
$mimetype = strip_tags($page_array[$i+6]);
}
if($page_array[$i] == "Stream Genre: ")
{
$stream_genre = strip_tags($page_array[$i+6]);
}
if($page_array[$i] == "Stream Title: ")
{
$stream_title = strip_tags($page_array[$i+6]);
}
if($page_array[$i] == "Current Song: ")
{
$currentsong = strip_tags($page_array[$i+6]);
}
}
}
else
{
$state = "Down";
}
}
fclose($fp);
#error_reporting(E_ALL ^ E_NOTICE);
?>


Kolay gelsin

<!--The Coders Script v2.0 çok yakında-->
<!--Bana balık vermeyin balık tutmayı öğretin.-->

Üye Profili

white_bullet Re:İnternet radyoları için shoutCast server den bilgi getirme (15/11/2009 14:40)
profil by_rehep
 offline OFFLINE
 New Coder

çalışmıyor bu arkadaşım
Warning: fsockopen() [function.fsockopen]: unable to connect to 85.17.188.147:3535 (Connection timed out) in /home/radyoar/public_html/radyo2.php on line 155

Warning: fclose(): supplied argument is not a valid stream resource in /home/radyoar/public_html/radyo2.php on line 263

bu hatayı verdi

profil

white_bullet Re:İnternet radyoları için shoutCast server den bilgi getirme (16/11/2009 00:51)
profil Dia
 offline OFFLINE
 Sleepless Coder

Arkadaşım script çalışmıyor değil sadece senin shoutcast serverine erişemiyor. bu nedenle time out oluyor. Ya serverin çok geç cevap veriyor yada erişim problemin var. Bence server ayarlarına bak.

<!--The Coders Script v2.0 çok yakında-->
<!--Bana balık vermeyin balık tutmayı öğretin.-->

profil
 
1 /
 
Ana Sayfa   Forum   PHP
Yeni Başlık Cevap Ekle
 

Advertisement


MENÜ » FORUM
Menü » Takip et
RSS Facebook Twitter Friendfeed
Sık Kullanılanlar Google Yahoo Live
Menü » Paylaş
E-Posta ile gönder Twitter Facebook Friendfeed
Buzz Stumbleupon Delicious Digg