$dom=new DOMDocument();
@$dom->loadHTML($cl);
$xpath=new DOMXpath($dom);
$dish_l=$xpath->query("/html/body/div/table[5]/tr/td/div/div");
echo $dish_l->length;
for($index=0;$index<$dish_l->length;$index++)
{
if( ($dish_id->item(0)->nodeValue) ) //I no need empty <div> blocks and this idea works perfect
{
}
}
but I got "Notice: Trying to get property of non-object"
if it just this php script I just disable show php errors and everything fine.
and I try to use it with Kohana and "Notice" appear again, script stop with ErrorException.
I tried some tips
for($index=0;$index<$dish_l->length;$index++)
{
if(!is_object ($dish_id ) )//but it is not works
{
}
else
{
if( ($dish_id->item(0)->nodeValue) )
{
}
}
}
How to ignore notice in Kohana or check is it object?