php - 来自 Vimeo 的 wp_remote_get 和/或 simplexml_load_string 是否有限制?

标签 php xml api

我知道 *wp_remote_get* 是一个 WordPress 函数,我应该将它发布在 wordpress.stackexchange 中,但是,我几乎可以肯定我的问题更多地出在一般的 PHP 方面。

问题:我需要检索在相册中找到的所有 Vimeo 视频,但我只得到 20 个。

方法:

$vmg_feed_url = 'http://vimeo.com/api/v2/';
$vmg_user = '2212323';
if($vmg_type == 'user'){ /** just an input variable checking whether the function should search for user or for album. in our case, it searches for album **/
    $vmg_type_url = '';
} else {
    $vmg_type_url = $vmg_type . '/';
}
$vmg_videos_url = $vmg_feed_url . $vmg_type_url . $vmg_user . '/videos.xml';
$videos_result = wp_remote_get($vmg_videos_url);
$vmg_videos = simplexml_load_string($videos_result['body']);

生成的 XML 是 http://vimeo.com/api/v2/album/2212323/videos.xml - 如您所见,我只检索了 20 个视频。

问题:我错过了什么吗?是否有函数/变量限制我可以检索的视频数量?我知道 wp_remote_get 给了我这些属性 ( from the WordPress Codex ):

$网址 (字符串)(必需)通用资源定位器 (URL)。 - 默认:无

$参数 (数组)(可选) - 默认:方法:GET,超时:5,重定向:5,httpversion:1.0,阻塞:true,headers:array(),body:null,cookies:array()

非常感谢任何帮助。如果我忘记了任何细节,请告诉我!

最佳答案

您的问题不在 wordpress 或 PHP 中。这是 API 限制:

http://developer.vimeo.com/apis/simple

Simple API responses include up to 20 items per page.

您可以通过在下一个请求中添加?page 参数来获取更多。

关于php - 来自 Vimeo 的 wp_remote_get 和/或 simplexml_load_string 是否有限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16759036/

相关文章:

php - Laravel 填充选项值

php - 想要存储图像路径

php - 从 Facebook 的 Graph API 嵌入视频的最佳方式是什么?

php - 获取mysql中的下一条和上一条记录

xml - 如何使用 VB .net 解析 XML

API 接口(interface)设计 - 切换或 2 个不同的接口(interface)

ajax - View 应该由应用程序呈现,还是静态站点应该使用 AJAX 联系 API?

java - 如何调整项目选择器 xml 中的图像大小

android - 在Android中使用SVG作为 ImageView 的资源

javascript - 受 pinterest 启发的仪表板布局