Skip to content

Instantly share code, notes, and snippets.

@basvandorst
Last active August 29, 2015 14:16
Show Gist options
  • Save basvandorst/7a7c8b559408b5b5b036 to your computer and use it in GitHub Desktop.
Save basvandorst/7a7c8b559408b5b5b036 to your computer and use it in GitHub Desktop.
kappers.nl scraping
<?php
// download @ http://sourceforge.net/projects/simplehtmldom/
require_once('simple_html_dom.php');
$cities = array(
'almere','amsterdam','rotterdam'
);
$total = 0;
foreach($cities as $city)
{
$html = new simple_html_dom();
$html->load_file('http://www.kappers.nl/'.$city);
foreach($html->find('.companies li') as $company)
{
$total++;
print "<hr />";
print "Naam: ".$company->find('h3 a',0)->innertext."<br />";
print "Adres: ".$company->find('.street-address',0)->innertext."<br />";
print "Postcode: ".$company->find('.postal-code',0)->innertext."<br />";
print "Plaats: ".$company->find('.locality',0)->innertext."<br />";
}
}
print $total;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment