Файл: inc/tools/mass_index_checker/functions.php
Строк: 22
<?php
function check_google($url)
{
$url=str_replace('http://','',$url);
$url=str_replace('www.','',$url);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/search?q=site%3A'.$url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$data = curl_exec($ch);
curl_close($ch);
if(!substr_count($data, 'did not match any documents'))
{
$from=strpos($data, 'of about <b>')+12;
$data2=substr($data, $from);
$to=strpos($data2, '</b>');
return substr($data2,0,$to);
}
else
return 0;
}
function check_yahoo($url)
{
$url=str_replace('http://','',$url);
$url=str_replace('www.','',$url);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://siteexplorer.search.yahoo.com/search?p=http%3A%2F%2F'.$url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$data = curl_exec($ch);
curl_close($ch);
if(!substr_count($data, 'We were unable to find any results'))
{
$from=strpos($data, '<strong>Pages (')+15;
$data2=substr($data, $from);
$to=strpos($data2, ')');
return substr($data2,0,$to);
}
else
return 0;
}
?>