PHP Sitemap Generator in english

PHP class which generates sitemaps compatible with protocol Sitemap 0.90. Class aims to cover specification in 100% and be as simple as possible. Usage examples can be found on phpclasses.org.

Class features:

  • Full compatibility with UTF-8
  • Support for Sitemap index
  • Handling up to 50,000,000 URLs
  • Support for robots.txt files
  • Automatic notification for Google, Yahoo!, Ask and Bling search engines.
  • Support for Yahoo App ID
  • Support for GZip

Link to code on PHPClasses: Sitemap Generator

Fork me on GitHub

11 comments

  1. Great class! I found that in phpclasses.org.

    I have a question: when the 50000 limit is touched, automaticaly the script generates „sitemap2.xml” (and so on) & updates the sitemap-index.xml?

    Thank you!

  2. Yes, exactly. It will generate successive sitemap files and put it all together to sitemap-index. You can test it by changing

    $maxURLsPerSitemap

    to small value. Advanced example shows it.

  3. Hello,

    Your class is very good, but i have a question :

    How we do to generate sitemaps when we have several millions of urls ? Without exhausted the allowed memory.

    Regards.

  4. Yes i did some tests this morning, with around 500,000 urls, and i’ve got a fatal error for the allowed memory.
    I will try this afternoon to do a system to write urls in file by parts, this will take less memory.

  5. Hi, I tried this class and it failed after 60000 url generated for allowed memory.
    I think it should write to file during the addurl method.
    If are planning to modify it let me know.
    I found also another bug in the robots function where sitemap filename is written like *.gz.gz
    However this functionalities where exactly what i was looking for.
    thanks.

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

Możesz użyć następujących tagów oraz atrybutów HTML-a: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>