<urlset>
-
<url>
<loc>http://patch/forum</loc>
<lastmod/>
<changefreq>always</changefreq>
</url>
</urlset>khisanthax wrote:can I run this script using a cron job??
MennoniteHobbit wrote:Why would you want to? It doesn't automatically submit your sitemap to Google. Also, it doesn't create static XML files AFAIK.
<?php
//based heavily on the fsockopen() example from php.net
$sitemap="http://www.yoursite.com/forums/sitemap.php";
$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /webmasters/sitemaps/ping?sitemap=".urlencode($sitemap)." HTTP/1.1\r\n";
$out .= "Host: www.google.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
if(preg_match("/200\sOK/", $response))
{
print "Sitemap submitted sucessfully.";
}
else
{
print "Problem submitting sitemap: \n $response";
}
}
?> Return to [2.0.x] MODs in Development
Users browsing this forum: No registered users and 1 guest