PHP, how do I output the the contents created by another php file to file?
<p>I'm trying to reduce the overhead on our database server. I use a php script to produce sitemaps of all the pages on out site, 80,000.</p>

<p>I want to create a cron job which will run once a week and create static versions of the php sitemap files.</p>

<p>However, I need to loop around and call the sitemap php script and output the contents to a separate file.</p>

<p>How do I output the contents of another php to a file for a cron job ?</p>

<p>EDIT:
I'll also need to wait or sleep a while so I don't bring down the server.</p>

<p>EDIT for Arvin for the flow of the PHP script etc</p>

<p>At the moment I have a sitemap.xml file which is a sitemap index file, which has lot of www.mydomain.com/sitemap.php?start=500&amp;max=500</p>

<p>The sitemap.php take between 1 second and 2 seconds to run and I have a lot of them.</p>

<p>What I'd like to do in a new script is ...</p>

<p>New script</p>

<p>-loop from N = 0 to 100</p>

<p>--output sitemap.php&amp;start=N&amp;max=500</p>

<p>--wait 20 seconds</p>

<p>-end loop</p>
