Q:

XML Sitemap generator in php

Possible Duplicate:
Creating an XML sitemap with PHP 

I'm trying to build an application where a user enters his website URL and gets the XML sitemap. I'm getting links, where a user gets his XML sitemap of his website by placing a file in the directory of his website which generates sitemap. But I want to generate it for any given URL. Can I get the directory structure of any given website using php? Any help would be appreciated. 

A:

Example from: http://www.alanmiller.com/blog/article/php-xml-sitemap-generator/
<?php

require_once('class.xml.sitemap.generator.php');

$entries[] = new xml_sitemap_entry('/', '1.0', 'weekly');
$entries[] = new xml_sitemap_entry('/foo.html', '0.9', 'weekly');
$entries[] = new xml_sitemap_entry('/bar.html', '0.1', 'monthly');
$entries[] = new xml_sitemap_entry('/baz.html', '0.1', 'monthly');

$conf = new xml_sitemap_generator_config;
$conf->setDomain('www.php.net');
$conf->setPath('/var/tmp/');
$conf->setFilename('sitemap.xml');
$conf->setEntries($entries);

$generator = new xml_sitemap_generator($conf);
$generator->write();

?>

