I tried retrieved meta tags of products (like 10,000) from an e-commerce site. The script works sometimes and fails rest of the time. The error I face is
Fatal error: Call to a member function find() on a non-object in ...
Please suggest better way of doing this.
Here is the code I'm using:
$url = "http://www.amazon.com/dp/".$asin;
$html = file_get_html( $url );
$metatags = array();
foreach( $html->find( 'meta[name]' ) as $meta ) {
$metatags[ 'meta' ][] = array(
'name' => $meta->name,
'content' => $meta->content
);
}