Answer the question
In order to leave comments, you need to log in
Why does Call to a member function find() on null error occur?
The error constantly occurs on different products, but always on this line $characteristic = $a2->find('.product_short_info_parametr', 0)->find('span');
$html_arr_p1 = $html1->find('.items_catalog_one_item');
foreach ($html_arr_p1 as $a2) {
$characteristic = $a2->find('.product_short_info_parametr', 0)->find('span');
{
Answer the question
In order to leave comments, you need to log in
obviously because find returned null, and you treat it as an object, try at least like this
$characteristic = ($t = $a2->find('.product_short_info_parametr', 0)) ? $t->find('span') : null;
You are trying in your code to work with an object whose reference is null. Either change the logic of the code, or at least set the check for the objects used in the code to null.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question