PHP simple_html_dom 没有正确解析 Apple 维基百科页面

PHP simple_html_dom not parsing Apple wikipedia page correctly

我正在尝试解析维基百科页面 - 由于某些原因,以下代码适用于所有维基百科页面(Apple 维基百科页面除外!!!)

include ('simple_html_dom.php');
$url = "http://en.wikipedia.org/wiki/Apple_Inc.";

$html = file_get_html($url);

Strlen for $html above returns 0 above for Apple.

注意: 当 $url 设置为 Microsoft 的其他维基百科页面时,上述代码工作正常 - http://en.wikipedia.org/wiki/Microsoft - for Diageo - http://en.wikipedia.org/wiki/Diageo,等

我想使用 file_get_html - 这样我就可以将它放入 DOM 对象中并进一步处理它。

将 simple_html_dom.php 中的 MAX_FILE_SIZE 常量更改为,例如

define('MAX_FILE_SIZE', 800000);

你很高兴... :) 如果是苹果页面,这就是你得到“0”的方式。 Strlen 超出限制...

if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)
{
    return false;
}