Trying to get all products from specific page with URLs from CSV but it's not working right. There are three arrays:
- $test_base
- $base - made from the CSV file
- $words
It works right just with $test_base, other ones returns empty arrays except last one LINK. And I just don't understand because this LINKS arrays are identical.
include_once('simple_html_dom.php');
// Getting links array
$base = file("base.txt");
$words = array();
foreach($base AS $word) {
$words[] = $word;
}
$test_base= array("LINK_1","LINK_2","LINK_3");
// Arrays are exactly the same
print_r($test_base);
print_r($base);
print_r($words);
// Main loop for one link
foreach($test_base AS $word) {
$html = file_get_html($word);
// Getting all info for one link
foreach($html->find('div.item_info') as $article) {
$item['title'] = $article->find('.item_name', 0)->plaintext;
$item['manufacture'] = $article->find('.item_additional-info', 0)->plaintext;
$item['price'] = $article->find('.price span', 0)->plaintext;
$articles[] = $item;
}
echo "<pre>";
print_r($articles);
echo "</pre>";
$html->clear();
unset($html);
}