Weird Error Using PHP Simple HTML Dom Parser

Weird error using PHP Simple HTML DOM parser

This error usually means that $html isn't an object.

It's odd that you say this seems to work. What happens if you output $html?
I'd imagine that the url isn't available and that $html is null.

Edit:
Looks like this may be an error in the parser. Someone has submitted a bug and added a check in his code as a workaround.

Error using PHP Simple HTML DOM parser

I'd try to output $element->href befor you do the file_get_html.
If the file_get_html can't get a page $html2 stays uniinitialized and you can't use find on it.

Beside that you could build a check wether $html2 is set after the file_get_html and output an error if not. I usually use something like this:

if($html2 == false || $html2 == NULL){
// no html found
}else{
// html found
}

PHP Simple HTML DOM Parser Returns Nothing On a Specific Website

You'll never get any price content from this web-page since it is loaded with JavaScript. If you want to achieve this, you'll need to use another scraping tool.
Your first reflex when you use SimpleHTMLDom is to echo the HTML you parse to see what the library is able to read ! Even the word تومان isn't read in this case !

echo $html = file_get_html('https://meghdadit.com/product/75293/');

Simple HTML DOM Parser error

You could test to see if $email is an object by using the is_object() function, e.g.

$email = $html->find('dl', 5);
if(is_object($email) === true)
{
print_r($email->children(3));
}
else continue;

This would probably be quicker than testing for children using an external library since it uses a function already present in the PHP engine.

The use of the PHP Simple HTML DOM Parser when parsing large html files results in an error

MAX_FILE_SIZE defined in simple_html_dom to be 600KB.

you can edit this code: define('MAX_FILE_SIZE', 600000); on simple_html_dom.php file.

worked for me

PHP Simple HTML DOM Parser not working

It ended up being a permissions issue with the simple_html_dom.php file - the permissions were set to 'none' for some reason.



Related Topics



Leave a reply



Submit