Last active
August 29, 2015 14:16
-
-
Save basvandorst/7a7c8b559408b5b5b036 to your computer and use it in GitHub Desktop.
kappers.nl scraping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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