i'm working on a parser to scrap all the prices of a categorie.(i work with simple_html_dom lib) I want to show the result as:
ProductName1 Price
ProductName2 Price
etc...
I have this:
$prices = $html->find('.price_container');
$titles = $html->find('.s_title_block');
foreach ($prices as $price) {
echo 'Precio <br>';
echo $price->innertext;
echo '<hr><br>';
}
foreach ($titles as $title) {
echo 'Nombre Producto <br>';
echo $title->innertext;
echo '<hr><br>';
}
$products = $title . $price;
foreach ($products as $product) {
echo $product->innertext;
}
It's okay, i have the prices, and the titles, but... It show separately, and i need to show it together..
The result i have with the code i have pasted below is something like that:
Precio 22,50 €
Precio 24,00 €
Precio 27,00 €
Precio 27,00 €
Precio 27,00 €
Precio 19,50 €
Precio 27,00 €
Precio 24,00 €
Precio 22,50 €
Precio 24,00 €
Precio 24,00 €
Precio 27,00 €
Precio 25,50 €
Precio 24,00 €
Precio 24,00 €
Precio 27,01 €
Precio 22,50 €
Precio 30,00 €
Precio 27,00 €
Precio 22,50 €
Precio 25,50 €
Precio 24,00 €
Precio 19,00 €
Nombre Producto ProductName1
Nombre Producto ProductName2
Nombre Producto ProductName3
Nombre Producto ProductName4
Nombre Producto ProductName5
Nombre Producto ProductName6
As i have asked, i need to show like that:
ProductName1 HisPrice
ProductName2 HisPrice
ProductName3 HisPrice
Thank you for your help it will be very apreciate.
Best regards