Skip to content

Commit

Permalink
First morph test
Browse files Browse the repository at this point in the history
  • Loading branch information
handelaar committed Apr 1, 2014
1 parent 9cbe7ca commit 45aefe1
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions scraper.php~
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*

Assemblywales.org Wransfinder
v0.1

John Handelaar


*/


require 'scraperwiki.php';
require 'scraperwiki/simple_html_dom.php';
date_default_timezone_set('Europe/London');

print "Fetching list of wrans pages...\n";

foreach(range(1,3) as $month) {
$html = file_get_html('http://assemblywales.org/bus-home/bus-business-fourth-assembly-written-questions.htm?ds=' . $month . '%2F2014');

$output=array();

foreach($html->find('dl[class=results] dd ul li a') as $target) {

if(trim($target->plaintext) === "Written Assembly Questions and Answers") {
$url = "http://assemblywales.org/" . str_replace("&amp;","&",$target->href);
$existingRecords = scraperwiki::select("* from data where `url`='" . $url . "'");

if (sizeof($existingRecords) == 0) {
scraperwiki::save(array('url'), $url);
}
unset($url);
}

unset($target);
}

unset($html);

}


0 comments on commit 45aefe1

Please sign in to comment.