-
Notifications
You must be signed in to change notification settings - Fork 0
/
scraper.php
33 lines (20 loc) · 825 Bytes
/
scraper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require 'scraperwiki.php';
require 'simple_html_dom.php';
$url_base = "https://www.yell.com/ucs/UcsSearchAction.do?keywords=pizza&location=southampton&scrambleSeed=833794509";
$mainUrl = scraperWiki::scrape($url_base);
$dom = new simple_html_dom();
$dom->load($mainUrl);
# Just focus on the a section of the web site
$dataset = $dom->find("div.businessCapsule-fle");
# The usual, look for the data set and if needed, save it
foreach($dataset as $record) {
# Slow way to transform the date but it works
# Put all information in an array
$application = array (
'name' => trim($record->find("div.businessCapsule--title")->plaintext),
'date_received' => date('Y-m-d', strtotime($date_received))
);
scraperwiki::save(array('council_reference'), $application);
}
?>