Permalink
Browse files

Add template for morph.io scraper

  • Loading branch information...
github-account1 committed Aug 5, 2015
0 parents commit 74028d23247aa5bcd9b86c8aa9f8d08ef4d6d3e0
Showing with 84 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 README.md
  3. +15 −0 composer.json
  4. +39 −0 composer.lock
  5. +27 −0 scraper.php
@@ -0,0 +1,2 @@
# Ignore output of scraper
data.sqlite
@@ -0,0 +1 @@
This is a scraper that runs on [Morph](https://morph.io). To get started [see the documentation](https://morph.io/documentation)
@@ -0,0 +1,15 @@
{
"repositories": [
{
"url": "https://github.com/openaustralia/scraperwiki-php.git",
"type": "git"
}
],
"require": {
"openaustralia/scraperwiki": "dev-morph_defaults",
"ext-sqlite3": "*",
"ext-pdo_sqlite": "*",
"ext-gd": "*",
"ext-mbstring": "*"
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,27 @@
<?
// This is a template for a PHP scraper on morph.io (https://morph.io)
// including some code snippets below that you should find helpful
// require 'scraperwiki.php';
// require 'scraperwiki/simple_html_dom.php';
//
// // Read in a page
// $html = scraperwiki::scrape("http://foo.com");
//
// // Find something on the page using css selectors
// $dom = new simple_html_dom();
// $dom->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'")
// 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".
?>

0 comments on commit 74028d2

Please sign in to comment.