title: Creating dynamic sitemap with php
body: <p>First let me tell you I am learning php. I want to create an automatically dynamic sitemap for my site. The script (suppose sitemap.php) will crawl all the links of my site and will create an array of 1000 urls. Once 1000 urls limit reaches, it will make an another page id with 1000 urls array. So that the script output will be like this :<br/></p>
  <pre><code>&lt;sitemapindex xmlns=&quot;http://www.google.com/schemas/sitemap/0.84&quot; 
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/siteindex.xsd&quot;&gt;
  
    &lt;sitemap&gt;
      &lt;loc&gt;http://exmaple.com/sitemap.php?page=1&lt;/loc&gt;
    &lt;/sitemap&gt;
    &lt;sitemap&gt;
      &lt;loc&gt;http://example.com/sitemap.php?page=2&lt;/loc&gt;
    &lt;/sitemap&gt;
  &lt;/sitemapindex&gt;
  </code></pre>
  <p>Page 1 will have 1000 urls in xml format and page 2 will have also and this will go on as the site is updated.I have tried so many codes from github and other seach pages from google. But have not found exactly what I need. Can you help please.</p>