PHP Classes

PHP Crawl Sitemap Generator: Crawl Web site and generate a XML sitemap

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 504 This week: 1All time: 5,791 This week: 571Up
Version License PHP version Categories
crawl-sitemap 1.0.0GNU General Publi...5XML, PHP 5, Searching, SEO
Description 

Author

This class can crawl Web site and generate a XML sitemap.

It crawls a given site retrieving the Web pages, parsing the HTML to extract the links to other pages.

The class parses the linked pages recursively until all links have been followed.

It can exclude a given list of directories so any contained URLs will not be crawled.

It generates a XML sitemap from the list of crawled pages and stores it in the sitemap.xml file.

Picture of Gianluca Zanferrari
  Performance   Level  
Name: Gianluca Zanferrari <contact>
Classes: 19 packages by
Country: The Netherlands The Netherlands
Age: 57
All time rank: 1674 in The Netherlands The Netherlands
Week rank: 103 Up4 in The Netherlands The Netherlands Equal
Innovation award
Innovation award
Nominee: 5x

Example

<?php
require_once('sitemap.class.php');
set_time_limit(0);

// replace the example URL with a real one
$targetUrl = 'http://www.yoursite.com/';
$arrExcludeFolders = array('http://www.yoursite.com/images/'); // empty array for no folder excluding

$sm = new sitemap($targetUrl, $arrExcludeFolders);

$sm->crawl($targetUrl);

// see class for more options
$sm->set_change_frequency('daily');

// leave second parameter for no output to browser
$sm->write_xml('sitemap.xml', TRUE);


  Files folder image Files  
File Role Description
Plain text file simple_html_dom.php Class html dom class
Plain text file sitemap.class.php Class class itself
Accessible without login Plain text file sitemap.example.php Example example script

 Version Control Unique User Downloads Download Rankings  
 0%
Total:504
This week:1
All time:5,791
This week:571Up