[ACCEPTED]-How to check if a SimpleHTMLDom element does not exist-simple-html-dom
Accepted answer
if(($html->find('.description', 0))) {
echo 'set';
}else{
echo 'not set';
}
http://www.php.net/manual/en/control-structures.if.php
0
According to the SimpleHtmlDOM Api str_get_html($html) expects 2 a string as input. First check with a html 1 validator if your code is well formatted.
$htmlObj = str_get_html($html);
if (!is_object($htmlObj)) return; // catch errors
// or wrap further code in
if (is_object($htmlObj)) { /* doWork */ }
$avalable = ($element->find('span.sold-out-text', 0)) ? 1 : 0;
It works for me.
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.