I am trying to use simple_html_dom to extract some data from a website. Unfortunately somehow in the middle of the data to be analyzed it cuts off a part which means the data that I want to extract is or is not part of the string that I can analyze.
This is my code:
<?php
include_once('../../simple_html_dom.php');
function mouser() {
$html = file_get_html('http://de.mouser.com/Search/Refine.aspx?Keyword=BSP75');
foreach($html->find('tr[class*=SearchResultsRow]') as $article) {
echo $article;
echo "\n\n\n\n\n\n --------------------------------------- \n\n\n\n\n\n\n\n";
$item['itemno'] = trim($article->find('a[id*=MfrPartNumberLink]', 0)->plaintext);
$return[] = $item;
}
$html->clear();
unset($html);
return $return;
}
$result = mouser();
foreach($result as $article) {
echo 'Articleno: '.$article['itemno'].'<br>';
echo '<hr />';
}
?>
Unfortunately this is the result:
Articleno: <br><hr />
Articleno: <br><hr />
Articleno: <br><hr />
Articleno: BSP752R<br><hr />
Articleno: BSP752T<br><hr />
I then analyzed why that is and found that the $html element is cut off at some point which means the next find() cant find anything.
It cuts off somewhere at the </div></a>
elements rather than waiting for the </tr>
Can anyone help me with this?