Asking myself if it does make sense to add a ping function like the one in the this sitemap function i attached.
Here is the function so you dont have to search for it:
//notifies services like google, bing, yahoo, ask and moreover about your site map update
public function ping($sitemap_url, $title ="", $siteurl = ""){
// for curl handlers
$curl_handlers = array();
$sitemap_url = trim($sitemap_url);
if(strpos($sitemap_url, "http") !== 0)
{
$sitemap_url = "http://".$sitemap_url;
}
$site = explode("//", $sitemap_url);
$start = $site[0];
$site = explode("/", $site[1]);
$middle = $site[0];
if(trim($title) == "")
{
$title = $middle;
}
if(trim($siteurl) == "")
{
$siteurl = $start."//".$middle;
}
//urls to ping
$urls[0] = "http://www.google.com/webmasters/tools/ping?sitemap=".urlencode($sitemap_url);
$urls[1] = "http://www.bing.com/webmaster/ping.aspx?siteMap=".urlencode($sitemap_url);
$urls[2] = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification".
"?appid=YahooDemo&url=".urlencode($sitemap_url);
$urls[3] = "http://submissions.ask.com/ping?sitemap=".urlencode($sitemap_url);
$urls[4] = "http://rpc.weblogs.com/pingSiteForm?name=".urlencode($title).
"&url=".urlencode($siteurl)."&changesURL=".urlencode($sitemap_url);
//setting curl handlers
foreach ($urls as $url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURL_HTTP_VERSION_1_1, 1);
$curl_handlers[] = $curl;
}
//initiating multi handler
$multi_curl_handler = curl_multi_init();
// adding all the single handler to a multi handler
foreach($curl_handlers as $key => $curl)
{
curl_multi_add_handle($multi_curl_handler,$curl);
}
// executing the multi handler
do
{
$multi_curl = curl_multi_exec($multi_curl_handler, $active);
}
while ($multi_curl == CURLM_CALL_MULTI_PERFORM || $active);
// check if there any error
$submitted = true;
foreach($curl_handlers as $key => $curl)
{
//you may use curl_multi_getcontent($curl); for getting content
//and curl_error($curl); for getting errors
if(curl_errno($curl) != CURLE_OK)
{
$submitted = false;
}
}
curl_multi_close($multi_curl_handler);
return $submitted;
}
So maybe if you call the sitemap whith
www.yourdomain.com/google_sitemap.php?ping=1 You can Ping that services Manually.
I guess thats usefull if you site is not listed in those services or if you have done some updates.
It may be even more usefull if you use your page like a blog, as there are lots of services you can ping.