streamlike / php-ws-sdk
使用此工具包轻松调用streamlike.com Web服务端点
1.1.0
2022-04-14 14:36 UTC
Requires
- php: >=5.4
- ext-json: *
- ext-simplexml: *
This package is auto-updated.
Last update: 2024-09-14 20:20:16 UTC
README
要求
PHP需要至少为PHP 5.4.0版本。
安装
下载包并包含streamlikeWs.php类。
或使用composer
composer require streamlike/php-ws-sdk
可用服务
播放列表
播放列表
媒体
相关
二维码
RSS
语言
国家
获取Streamlike版本
清单
当前播放
播客
恢复
视频地图
示例
自动加载
<?php // via composer autoload require './vendor/autoload.php'; // or basic require require './src/streamlikeWs.php'; $ws = new streamlikeWs('https://cdn.streamlike.com', 'json');
获取播放列表列表
<?php try { $params = array( 'company_id' => '48c6eab371919246', ); $content = $ws->getResult('playlists', $params, streamlikeWs::RESULTTYPE_RAW); var_dump($content); } catch (\Exception $e) { // handle exception, log, retry... }
GET投票
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com', 'xml', streamlikeWs::VERSION_V2); $params = array( 'company_id' => '48c6eab371919246', 'media_id' => '4df5ede70f252c07', 'value' => 3, ); $content = $ws->setVote($params); } catch (\Exception $e) { // handle exception, log, retry... }
GET带有许多过滤器的媒体列表
获取关于播放列表983e6509573f4849中前6个法国媒体的json内容,按创建日期降序排列
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com', 'json'); $params = array( 'playlist_id' => '983e6509573f4849', 'lng' => 'fr', 'pagesize' => 6, 'orderby' => 'creationdate', 'sortorder' => 'down' ); $content = $ws->getResult('playlist', $params); } catch (\Exception $e) { // handle exception, log, retry... }
GET带有统计信息的媒体
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com', 'xml'); $params = array( 'media_id' => '4df5ede70f252c07', 'rate' => 'true', ); $content = $ws->getResult('media', $params, streamlikeWs::RESULTTYPE_RAW); } catch (\Exception $e) { // handle exception, log, retry... }
GET二维码图片
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com'); $params = array( 'media_id' => '4df5ede70f252c07', ); $content = $ws->getResult('qr', $params); } catch (\Exception $e) { // handle exception, log, retry... }
GET所有媒体文件详细信息
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com'); $params = array( 'media_id' => '4df5ede70f252c07', ); $content = $ws->getResult('manifest', $params); } catch (\Exception $e) { // handle exception, log, retry... }
GET当前正在观看媒体的用户数量
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com'); $params = array( 'media_id' => '4df5ede70f252c07', ); $content = $ws->getResult('nowplaying', $params); } catch (\Exception $e) { // handle exception, log, retry... }
GET播客源
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com'); $params = array( 'playlist_id' => '983e6509573f4849', 'lng' => 'fr', 'orderby' => 'lastupdateddate', ); $content = $ws->getResult('podcast', $params); } catch (\Exception $e) { // handle exception, log, retry... }
GET与给定媒体相关的媒体
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com'); $params = array( 'media_id' => '4df5ede70f252c07', 'pagesize' => 4, ); $content = $ws->getResult('related', $params); } catch (\Exception $e) { // handle exception, log, retry... }
GETGoogle视频地图源
<?php try { $ws = new streamlikeWs('https://cdn.streamlike.com'); $params = array( 'company_id' => '48c6eab371919246', ); $content = $ws->getResult('videositemap', $params); } catch (\Exception $e) { // handle exception, log, retry... }