Title |
Price |
loadHTML($string);
$xpath = new DOMXPath($dom);
$titles = $xpath->query("//a[contains(@class, 'title')]");
$prices = $xpath->query("//span[contains(@class, 'currency-value')]");
for ($i=0; $i<$titles->length; $i++) {
$title = $titles->item($i)->textContent;
$link = $titles->item($i)->getAttribute('href');
$price = $prices->item($i)->textContent;
echo "\n";
echo "$title | \n";
echo "$price | \n";
echo "
\n";
}
?>