PHP Classes

File: sitemap.example.php

Recommend this page to a friend!
  Classes of Gianluca Zanferrari   PHP Crawl Sitemap Generator   sitemap.example.php   Download  
File: sitemap.example.php
Role: Example script
Content type: text/plain
Description: example script
Class: PHP Crawl Sitemap Generator
Crawl Web site and generate a XML sitemap
Author: By
Last change:
Date: 7 years ago
Size: 495 bytes
 

Contents

Class file image Download
<?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);