Skip to content

Commit

Permalink
Update scraper.php
Browse files Browse the repository at this point in the history
  • Loading branch information
flowscrap committed Apr 1, 2015
1 parent b63a1a2 commit a2193ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scraper.php
Expand Up @@ -4,19 +4,19 @@
//
// // Read in a page

$jsonImg = scraperwiki::scrape("http://www2.leboncoin.fr/ajapi/get/phone?list_id=787818167");
$jsonImg = scraperwiki::scrape("http://www2.leboncoin.fr/ajapi/get/phone?list_id=773980147");
var_dump($jsonImg);
if ($jsonImg != '""') {
$i = json_decode($jsonImg);
$src = $i->phoneUrl;
if ($src != "") {
$md5 = md5($src);
if (scraperwiki::select("* from data where 'adId'='787818167'")) {
echo "787818167 already in DB!\n";
if (scraperwiki::select("* from data where 'adId'='773980147'")) {
echo "773980147 already in DB!\n";
} else {
$img = base64_encode(file_get_contents($src));
scraperwiki::save_sqlite(array('adId'), array('md5' => $md5, 'adId' => "787818167", 'content' => $img));
echo "saved 787818167 in DB\n";
scraperwiki::save_sqlite(array('adId'), array('md5' => $md5, 'adId' => "773980147", 'content' => $img));
echo "saved 773980147 in DB\n";
}
}
}
Expand Down

0 comments on commit a2193ff

Please sign in to comment.