I am trying to extract data from a webpage to insert it to a database. The data I\'m interested in is in the div\'s which have a class=\"company\". On one webpage there are
To check if a node exists, verify that the length property is equal to 1 in the returned query result:
if ($company_name->length == 1) { $object->company_name = trim($company_name->item(0)->nodeValue); }