使用HTML dom时,我遇到某些网页的问题。我已经设置了用户代理并打开了一个流,但响应似乎是空的。
我注意到这些页面的内容是HTML中有未封闭的标签。这会影响简单的html dom吗?
我的代码是:
<?php
include_once 'simple_html_dom.php';
$url_to_compare = 'http://www.idigic.net/buy-instagram-followers/';
ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']);
$html = file_get_html($url_to_compare)->plaintext;
echo $html;
?>
答案 0 :(得分:-2)
检查此链接
http://simplehtmldom.sourceforge.net/manual.htm
我认为你需要它。
file_get_html 其获取数组,因此它不会在echo中显示任何内容。使用print_r可能有用。