$html = file_get_contents("http://www.somesite.com/");

$dom = new DOMDocument();
$dom->loadHTML($html); echo $dom;

THROWS

Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,
Catchable fatal error: Object of class DOMDocument could not be converted to string in test.php on line 10

(1) calling htmlentities() or similar on the string will fix the problem.

(2)To evaporate the warning, you can use libxml_use_internal_errors(true)

  libxml的链接:http://www.w3school.com.cn/php/php_ref_libxml.asp

From:http://stackoverflow.com/questions/1685277/warning-domdocumentloadhtml-htmlparseentityref-expecting-in-entity

PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,的更多相关文章

  1. Dokuwiki 二次开发记录

    Dokuwiki 二次开发记录 [转]http://www.syyong.com/other/Dokuwiki-Secondary-Development-Record.html DokuWiki 是 ...

  2. Injection Attacks-XML注入

    注入攻击 XML注入 虽然JSON的出现实现了服务器与客户端之间的"轻量级"数据交流,但是,作为另一种流行的可行方案,许多web服务API同时还是继续支持XML.另外,除了web服 ...

  3. PHP之道 - php各方面的知识汇总

    看到一个PHP的知识各方面的汇总,写的很有借鉴意义,搬过来了 转自: https://laravel-china.github.io/php-the-right-way/ 欢迎阅读 其他语言版本 参与 ...

  4. XML外部实体(XXE)注入详解

    ###XML与xxe注入基础知识 1.XMl定义 XML由3个部分构成,它们分别是:文档类型定义(Document Type Definition,DTD),即XML的布局语言:可扩展的样式语言(Ex ...

  5. apache+php生产环境错误记录

    报错1: [18-Jul-2016 14:36:31 Asia/Shanghai] PHP Warning:  DOMDocument::load(): I/O warning : failed to ...

  6. php之道

    PHP The Right Way. Tweet 欢迎 目前网络上充斥着大量的过时资讯,让 PHP 新手误入歧途,并且传播着错误的实践以及不安全的代码.PHP 之道 收集了现有的 PHP 最佳实践.编 ...

  7. 用trie树实现输入提示功能,输入php函数名,提示php函数

    参照刘汝佳的trie树 结构体 #include "stdio.h" #include "stdlib.h" #include "string.h&q ...

  8. php加载xml编码错误,“Error: Input is not proper UTF-8, indicate encoding! ”

    最近在给php中解析xml的时候,抛出一个错误: "Warning: DOMDocument::load(): Input is not proper UTF-8, indicate enc ...

  9. 谷歌(Chrome)安装Advanced REST Client插件

    进入Extensions(工具——>扩展程序) 点击Get More extensions或新建标签页点击网上应用店 如果加载太慢,出现chrome网上应用店无法打开,显示暂时无法加载该应用的画 ...

随机推荐

  1. 【转】iPhone易被窃听应用三分钟即可获取所有信息

    2011年8月9日10:19 “你有iPhone吗?这下你麻烦了!”昨天香港<东方日报>封面文章用这样的语气报道说,一种iPhone等智能手机窃听程序,正引爆香港. 该报记者亲自试验,发现 ...

  2. Linux 用户和用户操作

    1,创建组 groupadd test 增加一个test组 2,修改组 groupmod -n test2 test 将test组的名子改成test2 3,删除组 groupdel test2 删除  ...

  3. Matlab Codes and Datasets for Feature Learning

    Matlab Codes and Datasets for Feature Learning 浙江大学CAiDeng提供的Matlab特征学习Code.

  4. 用开源项目cropper实现对图片中任意部分进行裁剪

     红色区域为截图控件的区域.    开源项目地址:https://github.com/edmodo/cropper croper这个开源项目可以对一个图片进行任意区域的街区,并且可以设置图片的旋转角 ...

  5. JAVA生成并导出json文件

    将一个list集合转换成json文件并导出: 数据集合: List<Object> agencyList = new ArrayList<Object>(); Map<S ...

  6. [Web 前端] CSS篇之3. 如何保持浮层水平垂直居中

    原文链接](http://www.cnblogs.com/yaliu/p/5190957.html) 浮层水平垂直居中方法 (一)利用绝对定位与transform <div class=&quo ...

  7. C#零基础入门07:打老鼠之面向对象重构

    一:前言 有了上面两节的知识,尤其是第六节之后,现在我们回过头看我们的打老鼠游戏,我们是不是会发现:这个程序也太不面向对象了.我们所有的代码逻辑都分布在Code-Hide中(UI的后台代码,称之为Co ...

  8. [Link]Gearman分布式任务处理系统

    http://blog.csdn.net/jiao_fuyou/article/category/1745977 http://www.cnblogs.com/cocowool/archive/201 ...

  9. junit5了解一下

    要求java8及以上版本 JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage https://junit.org/junit5/docs/ ...

  10. SQL SERVER 的用户数,连接,连接池 license

    SQL SERVER 理论上有32767个逻辑连接,SQL SERVER根据系统自行调配连接池. 首先 ,操作系统的用户数:即同时通过网络连接到这台电脑上面的用户限制,以5用户操作系统,搭建的文件服务 ...