PHP code example of gonetone / hinet-hichannel-taiwan-radio
1. Go to this page and download the library: Download gonetone/hinet-hichannel-taiwan-radio library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gonetone / hinet-hichannel-taiwan-radio example snippets
$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;
nel("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();
}
use GoneTone\HiNetHichannel;
use GoneTone\Proxy;
xy("主機名", 3128, "http");
//$proxy->login("帳號", "密碼"); //如果 Proxy 伺服器需要驗證,請調用這登入
$hichannel = new HiNetHichannel("電台名稱", $proxy);
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();
}