使用SimpleXML的YouTube API实施不再有效

时间:2011-07-22 12:53:41

标签: php youtube youtube-api file-get-contents

我有一个网站使用公共XML Feed从用户的帐户中提取视频。 Feed的网址为:

https://gdata.youtube.com/feeds/api/users/USERNAME/uploads

通过PHP变量动态分配USERNAME的位置。点击此URL并获取内容的代码是:

$file = file_get_contents('https://gdata.youtube.com/feeds/api/users/'.$channel.'/uploads');
$xml = simplexml_load_file($file);

然而,现在这引发了一个奇怪的错误:

  

警告:file_get_contents()[function.file-get-contents]:不能   在/home/dpw/public_html/inc/modules/youtube.php中解析主机名   第46行

     

警告:   的file_get_contents(https://gdata.youtube.com/feeds/api/users/dpwrestling/uploads)   [function.file-get-contents]:无法打开流:操作失败   在第46行的/home/dpw/public_html/inc/modules/youtube.php中

     

警告:simplexml_load_file()[function.simplexml-load-file]:I / O   警告:无法加载外部实体“”   第47行/home/dpw/public_html/inc/modules/youtube.php

     

警告:为foreach()提供的参数无效   第49行/home/dpw/public_html/inc/modules/youtube.php

我不确定问题是什么,因为在我的网络浏览器中访问URL会返回XML。为什么我的PHP脚本现在无法检索它?

为了记录,我在托管环境中仍然启用allow_url_fopen,因为我使用打印echo ini_get('allow_url_fopen')的{​​{1}}进行了检查。

0 个答案:

没有答案