How to resubmit generated sitemaps automatically (using cron) or on an event (like re-generation of the sitemap).
<?php pingSE(urlencode($url),'google'); pingSE(urlencode($url),'bing'); pingSE(urlencode($url),'ask'); ?> |
And the function goodiness….
<?php function pingSE($sitemap,$service){ switch ($service) { case 'bing': $ping = "http://www.bing.com/webmaster/ping.aspx?siteMap=$sitemap"; break; case 'ask': $ping = "http://submissions.ask.com/ping?sitemap=$sitemap"; break; case 'google': $ping = "http://www.google.com/webmasters/tools/ping?sitemap=$sitemap"; break; default: return false; } $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,$ping); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $run = curl_exec($curl_handle); $response = curl_getinfo($curl_handle); curl_close($curl_handle); if ($response['http_code'] == 200){ echo "Sitemap successfully submitted"; } } ?> |