Skip to content

Commit

Permalink
Add template for morph.io scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
nishchayjain committed Feb 16, 2018
0 parents commit 50de47d
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
# Ignore output of scraper
data.sqlite
1 change: 1 addition & 0 deletions README.md
@@ -0,0 +1 @@
This is a scraper that runs on [Morph](https://morph.io). To get started [see the documentation](https://morph.io/documentation)
15 changes: 15 additions & 0 deletions composer.json
@@ -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": "*"
}
}
39 changes: 39 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions scraper.php
@@ -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 50de47d

Please sign in to comment.