PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Karol Janyst   Spider website   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Spider website
Crawl a site and retrieve the the URL of all links
Author: By
Last change: Comments correct
Date: 15 years ago
Size: 627 bytes
 

Contents

Class file image Download
<?php
 
// include Spider class file
 
require_once('spider.class.php');

 
// create new Spider object
 
$spider = new Spider('<enter your website URL here>');

 
// allow files with extension *.txt being spidered
 
$spider->allowType('txt');

 
// and disable files with that extension
 
$spider->restrictType('txt');

 
// set it to true if you want to see what is happening on the screen
 
$spider->setVerbose(true);

 
// start spidering website
 
$spider->startSpider();

 
// all found and fetched links are in that variable
 
$links = $spider->all_links;

 
// print it out
 
print_f($links);
?>