noc-med / tvkur-api-php-client
Tvkur Api Php Sdk
dev-master
2015-07-04 16:52 UTC
Requires
- zendframework/zend-http: 2.5.*
This package is not auto-updated.
Last update: 2024-09-24 02:03:32 UTC
README
简介
本模块是为 TVKUR API 编写的
安装
使用 composer 进行安装。在您的 composer.json 中添加此项目
"require": {
"noc-med/tvkur-api-php-client": "dev-master"
}
如果您没有 composer.phar (https://getcomposer.org.cn/download/)
要求
PHP 5.5 或更高版本。需要 PHP cURL 扩展。zendframework/zend-http
配置
$configs = array (
'tvkur' => array(
'api_url' => 'https://api.tvkur.com',
'authentication' => array(
'oauth' => array(
'grant_type' => 'client_credentials',
'client_id' => '61414062410',
'client_secret' => '18f98c0c61d091c985c1f4ebb5439158',
// 'username' => '',
// 'password' => '',
)
)
)
)
使用
$tvkurApiClient = new TvkurApiClient\TvkurApiClient(
array(
'configs' => $configs
'expire_in' => $expires_in, //optional
'acces_token' => $access_token, //optional
'token_type' => $token_type, //optional
'scope' => , => $scope, //optional
'api_path' => $api_path, //optional
)
);
$response = $tvkurApiClient->video()->get($id, (array) $queryParams);
或
$tvkurApiClient = new TvkurApiClient\TvkurApiClient();
$tvkurApiClient->setConfigs($configs);
$response = $tvkurApiClient->video()->get($id, (array) $queryParams);
$response = $tvkurApiClient->video()->get(null, array('title' => 'test title'));
$response = $tvkurApiClient->video()->get(null, array('categoryId' => 4));
$response = $tvkurApiClient->video()->get(null, array('categoryName' => 'test category name'));
$response = $tvkurApiClient->stream()->get(null, array('title' => 'test title'));
$response = $tvkurApiClient->playout()->get(null, array('title' => 'test title'));
响应内容
$response->getJsonResponse(); //salt json body
$response->getArrayResponse(); //salt array body
$response->getContent(); //array video or stream array content
$response->getLinks(); //array prev next self links
$response->getPageCount(); //integer total page count
$response->getPageSize(); //integer items count per page
$response->getTotalItems(); //integer total items count