Get the m3u8 streaming URL, program schedule and other information of HiNet hichannel Taiwan Radio!
Node.js version: https://github.com/GoneToneStudio/node-hinet-hichannel-taiwan-radio
If you find any BUG, please report it here: https://github.com/GoneToneStudio/php-hinet-hichannel-taiwan-radio/issues
Use Composer to install HiNet hichannel Taiwan Radio (PHP package).
composer require gonetone/hinet-hichannel-taiwan-radio
$ hichannel = new HiNetHichannel ( " Hichannel 完整頻道名稱 (string) " );
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> playUrl (); //HiNet hichannel m3u8 串流網址 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> title (); //HiNet hichannel 頻道名稱 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> id (); //HiNet hichannel 頻道 ID (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> desc (); //HiNet hichannel 頻道描述 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> area (); //HiNet hichannel 頻道區域 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> type (); //HiNet hichannel 頻道類型 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> imageUrl (); //HiNet hichannel 頻道圖片網址 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
print_r ( $ hichannel -> programList ()); //HiNet hichannel 頻道節目表 (array)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
try {
$ hichannel -> loadApi (); //加載 HiNet hichannel API
echo $ hichannel -> nowProgramName (); //HiNet hichannel 頻道目前節目名稱 (string)
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
use GoneTone HiNetHichannel ;
require_once ( dirname ( __FILE__ ) . " /vendor/autoload.php " );
$ hichannel = new HiNetHichannel ( " KISS RADIO 大眾廣播電台" ); //請輸入完整頻道名稱
try {
/* 加載 HiNet hichannel API */
$ hichannel -> loadApi ();
/* 取得 HiNet hichannel m3u8 串流網址 */
echo " m3u8 串流網址: " . $ hichannel -> playUrl () . "n" ;
/* 取得 HiNet hichannel 頻道名稱 */
echo "頻道名稱: " . $ hichannel -> title () . "n" ;
/* 取得 HiNet hichannel 頻道 ID */
echo "頻道 ID: " . $ hichannel -> id () . "n" ;
/* 取得 HiNet hichannel 頻道描述 */
echo "頻道描述: " . $ hichannel -> desc () . "n" ;
/* 取得 HiNet hichannel 頻道區域 */
echo "頻道區域: " . $ hichannel -> area () . "n" ;
/* 取得 HiNet hichannel 頻道類型 */
echo "頻道類型: " . $ hichannel -> type () . "n" ;
/* 取得 HiNet hichannel 頻道圖片網址 */
echo "頻道圖片網址: " . $ hichannel -> imageUrl () . "n" ;
/* 取得 HiNet hichannel 頻道目前節目名稱 */
echo "頻道目前節目名稱: " . $ hichannel -> nowProgramName () . "n" ;
/* 取得 HiNet hichannel 頻道節目表 */
echo "頻道節目表: n" ;
print_r ( $ hichannel -> programList ());
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
Please see examples/webpage/play_radio.php.
If the server running this program is not in Taiwan, please set up a Proxy server in Taiwan, otherwise the obtained streaming URL will fail verification (HTTP 403 Forbidden), but if the player IP and the server used to obtain the m3u8 streaming URL Different IPs will still be blocked. You can try to handle it on the server side before streaming it to the player, and then stream it a second time.
use GoneTone HiNetHichannel ;
use GoneTone Proxy ;
require_once ( dirname ( __FILE__ ) . " /vendor/autoload.php " );
/* 連線到 Proxy 伺服器 */
$ proxy = new Proxy ( "主機名" , 3128 , " http " );
//$proxy->login("帳號", "密碼"); //如果 Proxy 伺服器需要驗證,請調用這登入
$ hichannel = new HiNetHichannel ( "電台名稱" , $ proxy );
If you need to obtain new data, you must call $hichannel->loadApi()
again to obtain the latest data.
try {
/* 加載 HiNet hichannel API */
$ hichannel -> loadApi ();
/* 取得最新 HiNet hichannel m3u8 串流網址 */
echo " m3u8 串流網址: " . $ hichannel -> playUrl () . "n" ;
/* 取得最新 HiNet hichannel 頻道目前節目名稱 */
echo "頻道目前節目名稱: " . $ hichannel -> nowProgramName () . "n" ;
} catch ( Exception $ e ) {
echo $ e -> getMessage ();
}
MIT