$file = fopen('sitemap.xml', 'r+');
fputs($file, $xml);
$file = fopen('sitemap.xml', 'r+');
fputs($file, $xml);
$services = array(
'http://www.google.com/webmasters/sitemaps/ping?sitemap=
',
'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=
',
'http://webmaster.live.com/ping.aspx?siteMap=
',
'http://www.bing.com/webmaster/ping.aspx?siteMap=
',
'http://submissions.ask.com/ping?sitemap=
'
);
$mysitemapfile = 'http://site.com/sitemap.xml';
foreach($services as $service){
$url = str_replace('
', $mysitemapfile, $service);
@file($url);
}
ben bu yontemi kullanıyorum cronla zamanlayıp gönderiyorum hocam
Bende şimdi bunu yazdım ne kadar işlevsel bilmiyorum ama :) iş görür sanırım :)
class ping
{
function pingle($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $httpCode;
}
function sitemapingle($site)
{
$seo=array(
'http://www.google.com/webmasters/sitemaps/ping?sitemap=',
'http://www.bing.com/webmaster/ping.aspx?siteMap=',
);
$motorlar= array('Google','Bing');
for($a=0; $a {
$link=$seo[$a].$site;
if(self::pingle($link)==200)
{
$durum = "Sitemap ".$motorlar[$a]." arama motoruna başarıyla pinglendi
";
array_push($sonuc,$durum);
}
elseif(self::pingle($link)==400)
{
$durum = "Sitemap ".$motorlar[$a]." arama motoruna pinglenemedi
";
array_push($sonuc,$durum);
}
}
return $sonuc;
}
}
$al= new ping();
$sor= $al->sitemapingle('sitemap.xml');
print_r($sor);
?>