From 245c9cf2f08a5c7d872684f6f0feb5d8f421e76c Mon Sep 17 00:00:00 2001 From: <> Date: Wed, 16 Sep 2015 22:17:33 +1000 Subject: [PATCH] Copied from HuonValley (original project) --- scraper.php | 80 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/scraper.php b/scraper.php index 87fec18..6a5e84f 100644 --- a/scraper.php +++ b/scraper.php @@ -1,27 +1,57 @@ - -// This is a template for a PHP scraper on morph.io (https://morph.io) -// including some code snippets below that you should find helpful +load($html); -// print_r($dom->find("table.list")); -// -// // Write out to the sqlite database using scraperwiki library -// scraperwiki::save_sqlite(array('name'), array('name' => 'susan', 'occupation' => 'software developer')); -// -// // An arbitrary query against the database -// scraperwiki::select("* from data where 'name'='peter'") +require 'scraperwiki.php'; -// You don't have to do things with the ScraperWiki library. -// You can use whatever libraries you want: https://morph.io/documentation/php -// All that matters is that your final data is written to an SQLite database -// called "data.sqlite" in the current working directory which has at least a table -// called "data". -?> +date_default_timezone_set('Australia/Hobart'); + +require 'simple_html_dom.php'; + +$url = 'http://www.huonvalley.tas.gov.au/services/planning-2/planningnotices/'; + +$dapage = $url; +$html = scraperwiki::scrape($dapage); +$dom = new simple_html_dom(); +$dom->load($html); +$darow = $dom->find("table#list tbody tr"); +print 'number of records: ' . sizeof($darow); +foreach ($darow as $thisrow) { +//