-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
69 lines (48 loc) · 1.39 KB
/
init.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
$myPlunder = array(
//'img' => 1,
//'elements by id' => 'partLongDescription',
//'img xpath' => "//div[@id='ie8Image']/img",
//'description xpath' => "//div[@id='partLongDescText']/div",
//'children xpath' => "",
'metas' => true,
'titles' => true,
'headlines' => true,
'paragraphs' => true,
//'drop dashes' => true,
//'download imgs' => true,
);
if(!empty($_POST)){
if(empty($_POST['scrape_url'])){
$adu = new \Modules\Adulation\View\Adulator();
$sortedVars = $_POST;
$adu->args = $_POST;
$combos = $adu->recombine();
$file_id = generateRandomString(16);
$thisfile = $adu->adulate($combos, $file_id);
//$import = $adu->importCSV($file_id);
$success = true;
}
else{
$_POST['scrape_url'] = trim($_POST['scrape_url']);
if (!filter_var($_POST['scrape_url'], FILTER_VALIDATE_URL)) {
$url_error = true;
} else {
$url_error = false;
$ahoy = new \Modules\Crawler\View\AnchorsAway();
$ahoy->anchorsAway($_POST['scrape_url'], $myPlunder, 1);
$scrape = $ahoy->return;
$adu = new \Modules\Adulation\View\Adulator();
$ss_args = array(
'include titles' => $_POST["include_titles"],
'include metas' => $_POST["include_meta"],
'split title' => true,
);
$scrape_data = $adu->sortScrape($scrape,$ss_args);
if(!empty($scrape_data)){
$scrape_success = true;
}
}
}
}
?>