The script crawls through a website, searching for href's within the same domain. I've altered the script a bit so it lets google know when a new xml sitemap has been generated. When your website changes a lot you should frequently update your sitemap. By using this sitemap generator you can do this without any hassle.
You can change the location of the sitemap within the index.php. Just alter the variable $filename to your location (line 451 or so). You should also change the paramater $url_xml in the pingGoogle function on line 494 to the full path of the sitemap (e.g. http://www.domain.com/sitemap.xml). Otherwise you'll get a 400 error on pinging google. Make sure sitemap.xml has write permissions, so chmod sitemap.xml to 777.