Skip to content

Commit

Permalink
Update scraper.php
Browse files Browse the repository at this point in the history
  • Loading branch information
OmairXcluesiv committed Feb 9, 2017
1 parent 1c839fd commit 1e5048b
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions scraper.php
@@ -1,27 +1,21 @@
<?
// 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".
<?

require 'scraperwiki.php';
require 'scraperwiki/simple_html_dom.php';

$counter = 0;
$html = scraperwiki::scrape('https://www.olx.com.pk/cars/');
$dom = new simple_html_dom();
$dom->load($html);

$title = $dom->find("h3.large");
if(!empty($title)){
$counter;
}
echo $counter;





?>

0 comments on commit 1e5048b

Please sign in to comment.