ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์Toolsขอสคริปโชว์ข้อมูลการออกอากาศของสถานีวิทยุออนไลน์ครับ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: ขอสคริปโชว์ข้อมูลการออกอากาศของสถานีวิทยุออนไลน์ครับ  (อ่าน 1647 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
เสียวไว้ก่อนพ่อสอนไว้
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 75
ออฟไลน์ ออฟไลน์

กระทู้: 1,389



ดูรายละเอียด
« เมื่อ: 08 มีนาคม 2009, 18:05:19 »

ตัวอย่างของ siamwebhost นะครับ

http://www.siamwebhost.com/ip-radio.php

หรือใกล้เคียงแบบนี้ก็ได้ครับ .... ว่าแต่เจ้าของโฮสอยู่ในบอร์ดนี้ด้วยป่าวเอ่ย ...  Cheesy
บันทึกการเข้า
เสียวไว้ก่อนพ่อสอนไว้
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 75
ออฟไลน์ ออฟไลน์

กระทู้: 1,389



ดูรายละเอียด
« ตอบ #1 เมื่อ: 08 มีนาคม 2009, 22:20:09 »

เงียบสนิท ...  Cry
บันทึกการเข้า
BosnoS
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 222
ออฟไลน์ ออฟไลน์

กระทู้: 8,168



ดูรายละเอียด
« ตอบ #2 เมื่อ: 08 มีนาคม 2009, 22:34:36 »

คนละตัว แต่น่าจะประยุกต์ กันได้นะ

shout_stat.php
โค๊ด:
<?
include_once('ShoutcastInfo.class.php');
?>
<html>
<head>
  <title>Status Shoutcast</title>
  <meta http-equiv='refresh' content='30' />
  <meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
</head>
<body style="background:#000000;color:gray;font-family:Verdana;font-size=10">
<table width="350" align="center" style="border:0px solid blue;border-collapse:collapse;background:black;color:blue;">
<?php
$scs 
= &new ShoutcastInfo("210.1.31.203","8000"); //วิธีเรียกใช้งาน shout_stat.php


if( !$scs->connect() )
{
  
$scs->error();
  print 
'ติดต่อ Server ไม่ได้</td></tr>';
  
$error TRUE;
}

if( 
$error != TRUE )
{
  
$scs->send();
  if( !
$scs->get_stat() )
  {
    print 
'<tr><td colspan="2">ดีเจไม่อยู่ครับ</td></tr>';
  }
  else 
//If server is online..
  
{
    print 
'<tr><td width="30%" align="right" valign="top"><b><font size="2">PJ OnAir <font color="red">:</font</b></td>';
    print 
'<td width="70%"><font size="2" color="white">'.$scs->get_title().'</font></td></tr>';
    print 
'<tr><td align="right" valign="top"><b><font size="2" >Music <font color="red">:</font></b></td>';
    print 
'<td><font size="2" color="white">'.substr($scs->get_track(),0,27).'</font></td></tr>';
    print 
'<tr><td align="right" valign="top"><b><font size="2" >listener <font color="red">: </font></b></td>';
    
$listeners $scs->get_listener();
    print 
'<td><font size="2" color="white">'.$listeners.'</font></td></tr>';   
  } 
  
$scs->close();  


?>

  </table>
</body>
</html>

บันทึกการเข้า
BosnoS
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 222
ออฟไลน์ ออฟไลน์

กระทู้: 8,168



ดูรายละเอียด
« ตอบ #3 เมื่อ: 08 มีนาคม 2009, 22:36:50 »

ShoutcastInfo.class.php
โค๊ด:
<?php

class ShoutcastInfo
{

  var 
$sock FALSE;
  
  var 
$error = array(NULLNULL);
  
  var 
$hostname NULL;
  
  var 
$port NULL;
  
  var 
$timeout NULL;
  
  var 
$parsed FALSE;
  
  var 
$datas NULL;
  
  var 
$pdatas NULL;
  

  function 
ShoutcastInfo($hostname$port=8888$timeout=30)
  {
    
$this->hostname $hostname;
    
$this->port $port;
    
$this->timeout $timeout;
  } 
// ShoutcastInfo()
  

  
function connect()
  {
    if( !
$this->sock )
    {
      
//Connect
      
$this->sock fsockopen($this->hostname$this->port$this->error[0] , $this->error[1], $this->timeout);
    }
    
    
//Check connection
    
if( $this->sock )
    {
      return 
TRUE;
    }
    else
    {
      return 
FALSE;
    }
  } 
// connect()
  
  
function close()
  {
    if( 
$this->sock )
    {
      
fclose($this->sock);
    }
  } 
// close()
  

  
function refresh()
  {
    
$this->close();
    
$this->sock NULL;
    if( !
$this->connect() )
    {
      return 
FALSE;
    }
    
$this->parsed FALSE;
    
$this->send();
    return 
TRUE;
  } 
// refresh()
  

  
function send()
  {
    if( 
$this->sock )
    {
      
//Send HTTP Header
      
fputs($this->sock"GET / HTTP/1.0\r\n"
                        
."Host: 127.0.0.1\r\n"
                        
."User-Agent: Mozilla/4.0 (compatible; ShoutCastInfoClass/0.0.2; ".PHP_OS.")\r\n"
                        
."\r\n"
           
);
           
      
//Get datas
      
$this->datas NULL;
      while( !
feof($this->sock) )
      {
          
$this->datas .= fgets($this->sock128);
      }
    }
  } 
// send()
  
  
function error($return=FALSE)
  {
    if( 
$return == FALSE )
    {
      print 
"<br><b>Error:</b> {$this->error[1]} (<i>{$this->error[0]}</i>)<br>";
      return;
    }
    return 
"{$this->error[1]} ({$this->error[0]})";
  }
  

  function 
get_stat()
  {
    if( 
strstr($this->datas'Server is currently up and') )
    {
      
$this->pdatas['status'] = 1;
      return 
TRUE;
    }
    else
    {
      
$this->pdatas['status'] = 0;
      return 
FALSE;
    }
  } 
// get_stat()
  
  
function get_listener()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['listener'] = 0;
      return 
0;
    }
    
    
$this->pdatas['listener_max'] = explode('kbps with <B>'$this->datas);
    
$this->pdatas['listener'] = explode(' of '$this->pdatas['listener_max'][1]);
    
$this->pdatas['listener_max'] = $this->pdatas['listener'][1];
    
$this->pdatas['listener'] = $this->pdatas['listener'][0];
    
$this->pdatas['listener_max'] = explode(' l'$this->pdatas['listener_max']);
    
$this->pdatas['listener_max'] = $this->pdatas['listener_max'][0];
    
    return 
$this->pdatas['listener'];
  } 
// get_listener()
  
  
function get_peak()
  {
    
$this->pdatas['peak'] = $this->_extract_datas('Listener Peak: </font></td><td><font class=default><b>');
    return 
$this->pdatas['peak'];
  } 
// get_peak()
  
  
function get_title()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['title'] = FALSE;
      return 
FALSE;
    }
    
    
$this->pdatas['title'] = $this->_extract_datas('Stream Title: </font></td><td><font class=default><b>');
    return 
$this->pdatas['title'];
  } 
// get_title()
  
  
function get_content_type()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['content_type'] = FALSE;
      return 
FALSE;
    }
  
    
$this->pdatas['content_type'] = $this->_extract_datas('Content Type: </font></td><td><font class=default><b>');
    return 
$this->pdatas['content_type'];
  } 
// get_content_type()
  
  
function get_genre()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['genre'] = FALSE;
      return 
FALSE;
    }
  
    
$this->pdatas['genre'] = $this->_extract_datas('Stream Genre: </font></td><td><font class=default><b>');
    return 
$this->pdatas['genre'];
  } 
// get_genre()
  
  
function get_url()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['url'] = 'none';
      return 
'none';
    }
  
    
$this->pdatas['url'] = $this->_extract_datas('Stream URL: </font></td><td><font class=default><b><a href="''"');
    return 
$this->pdatas['url'];
  } 
// get_url()
  
  
function get_icq()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['icq'] = FALSE;
      return 
FALSE;
    }
  
    
$this->pdatas['icq'] = $this->_extract_datas('ICQ: </font></td><td><font class=default><b><a href="http://wwp.icq.com/scripts/contact.dll?msgto=''"');
    
//ICQ is aviable?
    
$this->pdatas['icq'] = ( $this->pdatas['icq'] == 'NA' ) ? FALSE $this->pdatas['icq'];
    return 
$this->pdatas['icq'];
  } 
// get_icq()
  
  
function get_aim()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['aim'] = FALSE;
      return 
FALSE;
    }
  
    
$this->pdatas['aim'] = $this->_extract_datas('AIM: </font></td><td><font class=default><b><a href="aim:goim?screenname=''"');
    
//AIM is aviable?
    
$this->pdatas['aim'] = ( $this->pdatas['aim'] == 'NA' ) ? FALSE $this->pdatas['aim'];
    return 
$this->pdatas['aim'];
  } 
// get_aim()
  
  
function get_irc()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['irc'] = FALSE;
      return 
FALSE;
    }
  
    
$this->pdatas['irc'] = $this->_extract_datas('Stream IRC: </font></td><td><font class=default><b><a href="');
    
$this->pdatas['irc'] = strstr($this->pdatas['irc'], '">');
    
$this->pdatas['irc'] = substr($this->pdatas['irc'], 2);
    return 
$this->pdatas['irc'];
    
  } 
// get_irc()
  
  
function get_track()
  {
    
//Is stream up?
    
if( $this->pdatas['status'] == )
    {
      
$this->pdatas['track'] = FALSE;
      return 
FALSE;
    }
  
    
$this->pdatas['track'] = $this->_extract_datas('Current Song: </font></td><td><font class=default><b>');
    return 
$this->pdatas['track'];
    
  } 
// get_track()
  
  
function parse()
  {
    if( 
$this->parsed != TRUE )
    {
      
//get all single infos
      
$this->get_stat();
      
$this->get_listener();
      
$this->get_peak();
      
$this->get_title();
      
$this->get_content_type();
      
$this->get_genre();
      
$this->get_url();
      
$this->get_icq();
      
$this->get_aim();
      
$this->get_irc();
      
$this->get_track();
      
//set parsed stat
      
$this->parsed TRUE;
    }
    return 
$this->pdatas;
    
  } 
// parse()
  
  
function get_parsed_value($key)
  {
    return ( isset(
$this->pdatas[$key]) ) ? $this->pdatas[$key] : FALSE;
    
  } 
// get_parsed_value()
  
  
function _extract_datas($match_str$ending='<')
  {
    
$datas strstr($this->datas$match_str);
    
//remove match_str because strstr starts before..
    
$datas str_replace($match_str''$datas);
    
//split text after ending mark and throw all away isnt needed.
    
$datas explode($ending$datas);
    return 
$datas[0];
    
  } 
// _extract_datas()

// ShoutcastInfo class


?>
บันทึกการเข้า
BosnoS
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 222
ออฟไลน์ ออฟไลน์

กระทู้: 8,168



ดูรายละเอียด
« ตอบ #4 เมื่อ: 08 มีนาคม 2009, 22:38:12 »

/***************************************************************************
 *                            ShoutcastInfo Class
 *                            -------------------
 *   begin                : Wednesday, Aug 18, 2004 - 4:12
 *   copyright            : (C) 2004 MC Breit
 *   email                : [email protected] - MCB.CC - Free and Open Sources
 *   last modified        : 18/08/04 - 06:26 - MC Breit
 *   version              : 0.0.2
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/


พอดี code มันยาว post ไม่ได้ ผมเลยตัดพวก comment ทิ้งไปหมดเลย ก็เลย copy ส่วน หัวมาให้ละกัน
บันทึกการเข้า
เสียวไว้ก่อนพ่อสอนไว้
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 75
ออฟไลน์ ออฟไลน์

กระทู้: 1,389



ดูรายละเอียด
« ตอบ #5 เมื่อ: 08 มีนาคม 2009, 22:42:14 »

ขอบคุณมากครับท่านเต้  Kiss

+ thanks ให้เรียบร้อยครับ

ปล. ขอให้ 6 หลัก ในเร็ววันนะครับ ...  Smiley
บันทึกการเข้า
Sarbuy
ก๊วนเสียว
*

พลังน้ำใจ: 15
ออฟไลน์ ออฟไลน์

กระทู้: 425



ดูรายละเอียด เว็บไซต์
« ตอบ #6 เมื่อ: 08 มีนาคม 2009, 23:51:24 »

โอ้.. ขอบคุณครับ ส่วนตัวในของโฮสเก่า เดี๋ยวขอลองอันนี้น่อยแฮ่ะ
ขอบคุณมากครับ
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
พิมพ์