-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscraper.php
35 lines (31 loc) · 1.02 KB
/
scraper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Goutte\Client;
$client = new Client();
// Set a "real" user agent, otherwise the server will run away and hide
$client->config['headers']['User-Agent'] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36";
try {
switch($argv[1]) {
case "pna.ro":
case "pna":
case "dna":
if(!include('scrapers/pna.ro.php'))
throw new \Exception("Scraper does not exist!");
break;
case "linx.crji.org":
case "linx":
if(!include('scrapers/linx.crji.org.php'))
throw new \Exception("Scraper does not exist!");
break;
case "theblacksea":
case "theblacksea.eu":
if(!include('scrapers/theblacksea.eu.php'))
throw new \Exception("Scraper does not exist!");
break;
case "upload":
system("rsync -avP . ioana@linx:/var/www/html/scraper/");
break;
}
} catch (Exception $e) {
echo "Exception: " . $e->getMessage();
}