-3

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.

Community
  • 1
  • 1
Kishor Kumar
  • 543
  • 1
  • 12
  • 33
  • I tried to get the list of URL's of given page but its giving only URLs of that page. I want to get the change frequency and priority too. Guide me If I'm wrong. – Kishor Kumar Oct 27 '12 at 09:51

1 Answers1

3

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();

?>
twodayslate
  • 2,803
  • 3
  • 27
  • 43