As I want to understand Simple HTML Dom a bit I am playing around with it, to test options on my localhost.
Basically I want to take the titles and intro's of this website and display them on my page.
The title as <h2>
and the intro as <p>
.
What am I doing wrong?
<?php
include 'simple_html_dom.php';
// Create DOM from URL
$html = file_get_html('http://www.nu.nl/algemeen');
foreach($html->find('div[class=list-overlay]') as $article){
$title['intro'] = $article->find('span[class=title]', 0)->innertext;
$intro['details'] = $article->find('span[class=excerpt]', 0)->innertext;
echo '<h2>'. $articles . '</h2>
<p>'. $title .'</p>';
}
?>
edit: There was a double line in there.