-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspiderMan.php
43 lines (34 loc) · 1 KB
/
spiderMan.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
<?php
require 'WebSpider.php';
require 'ImportWebsite.php';
$webSpider = new WebSpider($websiteUrl);
$importWebsite = new ImportWebsite($websiteUrl);
$pagesArray = array();
$websiteMap = $webSpider->getWebsiteMap();
foreach ($websiteMap as $websiteUrl => $level){
$content = $webSpider->getContent($websiteUrl);
preg_match("/http:\/\/".$websiteUrl."\/(.*)?\.[html|php]/", $websiteUrl, $matches);
if (empty($matches)){
$matches[1] = 'index';
}
$pagesArray[] = array(
'title' => $matches[1],
'status' => 'y',
'slug' => $matches[1],
'content' => $content,
'date' => date('j M Y')
);
}
$importWebsite->pages($pagesArray);
$importWebsite->buildTemplate();
/*
require 'Process/Manager.php';
require 'Process/Process.php';
$launchPath = rtrim(realpath(dirname(__FILE__)), '/').'/webSpider.php';
$manager = new Oara_Import_Process_Manager();
$manager->executable = "php -f";
$manager->root = $launchPath;
$manager->processes = 10;
$manager->sleep_time = 2;
$manager->exec();
*/