Isn't it a bad idea returning false
for non-existing (or too large) documents? Because this triggers a fatal error and the entire script halts, even though the problem is just local to a single document. Returning null triggers a non-fatal error and the script continues, which seems better.
$html = file_get_html("404.html");
simple_html_dom/simple_html_dom.php(113):file_get_contents(404.html): Failed to open stream: No such file or directory
$items = $html->expect(".bar");
PHP Fatal error: Uncaught Error: Call to a member function expect() on bool
diff --git a/simple_html_dom.php b/simple_html_dom.php
index bce4d9e..095245f 100644
--- a/simple_html_dom.php
+++ b/simple_html_dom.php
@@ -117,3 +117,3 @@ function file_get_html(
$dom->clear();
- return false;
+ //return false;
}
@@ -144,3 +144,3 @@ function str_get_html(
$dom->clear();
- return false;
+ //return false;
}
Better version with tabs.
PS! The inline editor and preview function on the site seems to hide the first line of content :|