I have an rss feed which i would like to read from in my page, i have a local copy of the feed which reads fine but i am required to use the online version. From what i can see i am doing this correctly:

我有一个RSS浏览器,我想在我的页面中读取,我有一个本地的饲料副本,读取正常,但我需要使用在线版本。从我可以看到我正确地做到这一点:

        $url ='http//www.numyspace.co.uk/~cgel1/holidays/holidays.xml';
        $holidayDoc = simplexml_load_file($url);

However i am met with the following error:

但是我遇到以下错误:

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http//www.numyspace.co.uk/~cgel1/holidays/holidays.xml"

警告:simplexml_load_file()[function.simplexml-load-file]:I / O警告:无法加载外部实体“http // www.numyspace.co.uk /~cgel1 / holidays / holidays.xml”

Why is this not working?

为什么这不起作用?

1 个解决方案

#1


1

$use_errors = libxml_use_internal_errors(true);
$xml = simplexml_load_file("http://www.numyspace.co.uk/~cgel1/holidays/holidays.xml");
if (!$xml) {
  //throw new Exception("Cannot load xml source.\n");
}
libxml_clear_errors();
libxml_use_internal_errors($use_errors);

You missed a colon

你错过了冒号

更多相关文章

  1. 如何使用Thymleaf做到这一点?

随机推荐

  1. Netty多语言(Java、Android 、C#、WebSock
  2. android 自定义按钮样式
  3. Android 各种音量的获取和设置
  4. ImageView android:scaleType属性详解
  5. 设置组件圆角
  6. Android(安卓)Sliding Menu
  7. Android android:exported = true 用法详
  8. Android存储-SharedPreferences
  9. Android系统启动流程 -4
  10. Android中设置控件可见与不可见详解