add example
This commit is contained in:
parent
ca4686f81b
commit
dbe1481e5c
19
example/crawl.php
Executable file
19
example/crawl.php
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
require_once(__DIR__.'/../vendor/autoload.php');
|
||||||
|
|
||||||
|
if(!$url=$argv[1]??null){
|
||||||
|
die("url?\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
use \JHodges\Sitemap\Crawler;
|
||||||
|
|
||||||
|
$crawler=new Crawler();
|
||||||
|
$crawler->crawl($argv[1]);
|
||||||
|
|
||||||
|
foreach($crawler->getResults() as $url=>$result){
|
||||||
|
echo("{$result['code']} {$url}\n");
|
||||||
|
foreach($result['foundOn'] as $url=>$count){
|
||||||
|
echo(" -> ($count) $url\n");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user