Obtenha o URL de streaming m3u8, programação do programa e outras informações da HiNet hichannel Taiwan Radio!
Versão Node.js: https://github.com/GoneToneStudio/node-hinet-hichannel-taiwan-radio
Se você encontrar algum BUG, relate-o aqui: https://github.com/GoneToneStudio/php-hinet-hichannel-taiwan-radio/issues
Use o Composer para instalar o HiNet hichannel Taiwan Radio (pacote PHP).
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 ();
}
Por favor veja exemplos/webpage/play_radio.php.
Se o servidor que executa este programa não estiver em Taiwan, configure um servidor proxy em Taiwan, caso contrário, o URL de streaming obtido falhará na verificação (HTTP 403 proibido), mas se o IP do player e o servidor usado para obter o URL de streaming m3u8 forem diferentes Os IPs ainda serão bloqueados. Você pode tentar lidar com isso no lado do servidor antes de transmiti-lo para o player e, em seguida, transmiti-lo uma segunda vez.
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 );
Se precisar obter novos dados, você deve chamar $hichannel->loadApi()
novamente para obter os dados mais recentes.
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