I am planning to implement XML Sitemap Generation, User will enter URL, than PHP script will generate XML file, PHP script will track the XML generation from Max URL completion, for ex:once it reaches 100 URL, XML file will be created and prompt User to download the file.
Now, How I can show real time Progress to User in Webpage, and once complete, XML file will be downloaded to Client desktop.
$depth = 100; --> To track completion.
$map_row = "<url>\n";
$map_row .= "<loc>$url</loc>\n";
if ($enable_frequency) {
$map_row .= "<changefreq>$freq</changefreq>\n";
}
if ($enable_priority) {
$map_row .= "<priority>$priority</priority>\n";
}
if ($modified) {
$map_row .= " <lastmod>$modified</lastmod>\n";
}
$map_row .= "</url>\n";
fwrite($file_stream, $map_row);
$indexed++;
....
...
....
// Begin by crawling the original url
scan_url($real_site);
// Finalize sitemap
fwrite($file_stream, "</urlset>\n");
fclose($file_stream);
header('Content-disposition: attachment; filename=sitemaptest.xml');
readfile('sitemaptest.xml');
die; //modified code
Submit Form button as follows :
<form class="form-horizontal" method="post">
<textarea class="form-control" name="url" placeholder="Enter URL to Submit"></textarea>
<br>
<input class="form-control btn btn-warning" type="submit">
</form>