The problem I have is the following:
I'm doing a metacritic parser that collects data from the search pages to add them to a database and then it shows it in an autocomplete of a search box on my website.
The parser passes the content to an array of strings and makes an encode in json to be able to process it more easily, but the question is that I only pick up an element randomly, and it does not take all the nodes on which it hangs (about 401 nodes).
If I apply it to look for the class "first_product" if it shows me the first element, but I can not get it to show the other elements.
foreach ($html->find('div[class=product_condensed] ol[class=list_products list_product_condensed]') as $div1) {
foreach ($div1->find('li[class=product game_product first_product] div[class=product_wrap] div[class=basic_stat product_title] a') as $element) {
$name = trim($element->plaintext);
}
}
foreach ($html->find('div[class=product_condensed] ol[class=list_products list_product_condensed]') as $div1) {
foreach ($div1->find('li[class=product game_product] div[class=product_wrap] div[class=basic_stat product_score brief_metascore] div[class=metascore_w small game]') as $element) {
$metascritic_score = intval($element->plaintext);
}
}
foreach ($html->find('div[class=product_condensed] ol[class=list_products list_product_condensed]') as $div1) {
foreach ($div1->find('li[class=product game_product first_product] div[class=product_wrap] div[class=more_stats condensed_stats] span[class=data textscore textscore_unfavorable]')as $element) {
$user_score = floatval($element->innertext);
}
}
foreach ($html->find('div[class=product_condensed] ol[class=list_products list_product_condensed]') as $div1) {
foreach ($div1->find('li[class=product game_product first_product] div[class=product_wrap] div[class=more_stats condensed_stats] li[class=stat release_date] span[class=data]')as $element) {
$release_date = trim($element->plaintext);
}
}
How could this be done?