updated@22:10msk 04Jan09
source:code.txt
<?
function getYA($url){
$file = @join("", @file('http://search.yaca.yandex.ru/yca/cy/ch/'.$url.'/'));
if(preg_match("!—\s+([0-9]{0,8})<\/b>!is",$file,$ok)) {$cy=$ok[1];}
else if(preg_match("!<td class=\"current\" valign=\"middle\">(.*?)</td>\n</tr>!si", $file, $ok)){
if(preg_match("!<td align=\"right\">(.*?)</td>\n</tr>!si", $ok[0], $str)){ $cy=$str[1]; } else {$cy=0;}
} else { $cy=0;}
if(strpos($file,'ресурс не описан в Яндекс.Каталоге')===false) {
/*
preg_match( '/<td class="current"(.*?)<td align="right">\d{1,}</td>/is',$file, $alt);
var_dump($alt); */
// тема +
preg_match_all('!<h1><a href="http://(.*?)">(.*?)</a></h1>!is', $file, $topic);// исправить регэксп!
$topic=$topic[2][1]; //echo "<b>$topic</b>";
} else {$topic=''; }
// скл. +
preg_match('!<TITLE>Яндекс.Каталог:(.*?)индекс цитирования (.*?)</TITLE>!is', $file, $st); // исправить регэксп!
$st=$st[2];
$st=str_replace("\n",'',$st);
$st=str_replace("\r",'',$st);
if (($st==$url) OR ($st=='www.'.$url)) {$st=''; } else {$topic='';}
return array($cy,$topic,$st);
}
?>
<html>
<head><title>cycheck by LazutovAlexander</title></head>
<body>
<form method=post>
<textarea name="list" cols="40" rows="25"><? if (isset($_POST['list'])) echo $_POST['list']; else echo "lazutov.ru"."\n"."mywhois.name"."\n"."\n"."ya.ru"."\n"."rambler.ru"; ?> </textarea>
<br><input type="submit" value="Отправить">
</form>
<?
// Програма для проверки тИЦ
// Alexander N Lazutov (c) 2009
// При публикации активная ссылка на http://lazutov.ru/ обязательна.
if (isset($_POST['list'])){
$list= $_POST['list'];
$list =str_replace("\r",'',$list);
$list = explode("\n", $list); // далее explode по \n ,
for ($i=0; $i<count($list);$i++) {
$list[$i]=str_replace("\n",'',$list[$i]);
if ($list[$i]!=''){$r=getYA(trim($list[$i]));
echo $list[$i].':'.$r[0]."\n";
echo '<br>'; flush();
}}
}
?>
<br>
<a href="http://lazutov.ru"> CYcheck by Lazutov Alexander</a>
</body>
</html>
1