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

  Login   Register  

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

Recommend this page to a friend!
     
  Info   Example   Files   Install with Composer   Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 507 All time: 5,783 This week: 43
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.

  Performance   Level  
Name: Gianluca Zanferrari <contact>
Classes: 19 packages by
Country: The Netherlands
Age: 58
All time rank: 1674 in The Netherlands
Week rank: 195 4 in The Netherlands
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 (3)  
File Role Description
simple_html_dom.php Class html dom class
sitemap.class.php Class class itself
sitemap.example.php Example example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:507
This week:0
All time:5,783
This week:43
For more information send a message to info at phpclasses dot org.
archive
ssrg-dailysentinel-cc9dfc22