Skip to content

Commit

Permalink
Added an example
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris DeGroat committed Jun 5, 2014
1 parent 6b2d20c commit a4329d9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Expand Up @@ -6,6 +6,11 @@ Simple PHP utility for scraping a table from HTML
```php
require "zamboni.php";
$zamboni = new zamboni();
$zamboni->load_from_url('http://www.imdb.com/chart/top');
$data = $zamboni->extract('TABLE.chart');
$zamboni->load_from_url('http://www.w3schools.com/browsers/browsers_stats.asp');
$data = $zamboni->extract('TABLE.reference');
print_r($data);
```

The Zamboni extract method is powered by Ganon. You can learn more about what selectors are supported on that website:

https://code.google.com/p/ganon/
7 changes: 7 additions & 0 deletions example.php
@@ -0,0 +1,7 @@
<?
require "zamboni.php";
$zamboni = new zamboni();
$zamboni->load_from_url('http://www.w3schools.com/browsers/browsers_stats.asp');
$data = $zamboni->extract('TABLE.reference');
print_r($data);
?>
1 change: 1 addition & 0 deletions zamboni.php
Expand Up @@ -41,6 +41,7 @@ public function extract($table_selector, $nth_table = 1, $row_selector = 'tr',

$html = str_get_dom($this->html);
$table = $html($table_selector, $nth_table-1);

foreach($table($row_selector) as $row)
{
$item = array();
Expand Down

0 comments on commit a4329d9

Please sign in to comment.