Using this code with simplehtmldom script (http://simplehtmldom.sourceforge.net/manual.htm):
function file_get_html() {
$dom = new simple_html_dom;
$args = func_get_args();
$dom->load(call_user_func_array('file_get_contents', $args), true);
return $dom;
}
$url = 'http://site.com/';
$html = file_get_html($url);
How to handle erros on file_get_html($url)
part? Now, if page doesn't exist, it shows errors in browser window. I prefer to catch them and show my text instead, like:
if(some error happened on file_get_html($url)) {
$errors = true;
} else {
html = file_get_html($url);
}
Thanks.