function send_url($url, $map) { $data = false; $file = $url.urlencode($map); if( function_exists( 'curl_init' ) ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $file ); curl_setopt( $ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 6 ); $data = curl_exec( $ch ); curl_close( $ch ); return $data; } else { return @file_get_contents( $file ); } }
CREATE TABLE IF NOT EXISTS `sitemaps` ( `id_sitemap` mediumint(8) unsigned NOT NULL auto_increment, `url_sitemap` text, PRIMARY KEY (`id_sitemap`) ) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n<td valign='top' width='33%' class='small'>\n";
echo "<a href='".ADMIN1."index.php".$aidlink."&action=sitemap'>Подать карты сайтов в поисковики</a>\n"; if ($_GET['action'] == "sitemap") { $result_links = dbquery("SELECT id_sitemap, url_sitemap FROM sitemaps"); while ($data = dbarray($result_links)) { $map_link = $data['url_sitemap']; if (strpos ( send_url("http://google.com/webmasters/sitemaps/ping?sitemap=", $map_link), "successfully added" ) !== false) { echo $buffer = "<br />Google: Ок! ".$map_link; } else { echo $buffer = "<br />Google: Ошибка!".$map_link; } if (strpos ( send_url("http://ping.blogs.yandex.ru/ping?sitemap=", $map_link), "OK" ) !== false) { echo $buffer = "<br />Yandex: Ок! ".$map_link; } else { echo $buffer = "<br />Yandex: Ошибка!".$map_link; } send_url("http://www.bing.com/webmaster/ping.aspx?siteMap=", $map_link); echo $buffer = "<br />Bing: Ок! ".$map_link; if (strpos ( send_url("http://submissions.ask.com/ping?sitemap=", $map_link), "submission was successful" ) !== false) { echo $buffer = "<br />Ask: Ок! ".$map_link; } else { echo $buffer = "<br /> Ask: Ошибка! ".$map_link; } } }