问题描述
我需要一种使用 PHP 在页面上显示来自特定频道的视频的方法.
I need a way to display videos from a specific channel on a page using PHP.
我已经对我的应用程序进行了身份验证,并且可以使用一些使用高级 API 的方法.我使用官方vimeo PHP库连接.
I have authenticated my app and I can use some methods using the advanced API. I am using the official vimeo PHP library to connect.
下面是我正在尝试做的事情,当我转储数组时,我什么也没得到.我可以通过使用整个帐户方法的获取视频来获取信息.
Below is what I am trying to do and when I dump the array I do not get anything. I can get info back from using get videos from the entire account method.
require_once('/url/vimeo/vimeo.php');
$vimeo = new phpVimeo('number', 'number');
$vimeo->setToken('number','numbers');
$videos = $vimeo->call('vimeo.channels.getVideos', array('ACCOUNT' => 'NAME'));
如果我将频道名称放在 ACCOUNT 所在的位置,我将收到无效签名错误.
If I put the channel name where ACCOUNT is I will get an invalid signature error.
是否值得为 PHP 使用简单的 HTML 解析器之类的东西并这样做,或者是否值得坚持使用高级 API?
Is it worth using something like simple HTML parser for PHP and doing it that or worth sticking with the advanced API?
推荐答案
我强烈建议使用高级 API.如果您解析 html,它会在 vimeo 更改其频道页面时中断.此外,频道有不止一种布局
I would highly advise using the advanced api. If you parse the html, it will break any time vimeo changes their channel pages. Additionally, channels have more than one layout
调用"函数的第二个参数应该是 api 方法需要的任何查询字符串参数.
The second parameter of the "call" function should be any querystring parameters the api method requires.
在vimeo.channels.getVideos"的情况下,您可以提供
In the case of "vimeo.channels.getVideos" you can provide
- channel_id
- user_id
- 页面
- 每页
- summary_response
- full_response.
要试验 getVideos 方法,您可以使用 playground.
To experiment with the getVideos method, you can use the playground.
所以最后,我相信您希望函数看起来像这样..
So in the end, I believe you want the function to look like this..
$videos = $vimeo->call('vimeo.channels.getVideos', array('channel_id' => 'NAME'));
其中 NAME 是频道 ID 或频道名称(频道名称与 url slug 匹配,例如nicetype"而不是nice type"
where NAME is either the channel id, or the channel name (the channel name matches the url slug, so for example "nicetype" not "nice type"
这篇关于显示频道中的视频列表 - Vimeo Advanced API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!