Tuesday, October 03, 2006

пределения тИЦ сайта.

<?
function getTIC($url)
{
$str=file('http://bar-navig.yandex.ru/u?ver=2&show=32&url='.$url);
if ($str==false)
{
$ans=false;
}
else
{
$is_find=preg_match("/value=\"(.\d*)\"/", join("",$str), $tic);

if ($is_find<1)
{
$ans=0;
}
else
{
$ans=$tic[1];
}
}


return $ans;
}
?>

Saturday, September 30, 2006

Php Parser

Как пользоваться небуду учить, кому надо сам разберется во всем :)

<?
set_time_limit(0);
set_magic_quotes_runtime(0);
error_reporting(0);

function get_page($n){
$n--;
$n=$n*100;

$sock = fsockopen ("www.google.ru", 80);
fputs ($sock, "GET http://www.google.ru/search?q=inurl:%22viewforum.php%3Ff%3D%22&num=100&hl=ru&lr=&start=$n&sa=N HTTP/1.0\r\nHost: $host\r\n\r\n");
$cont = "";
while (!feof ($sock)) { $cont .= fgets ($sock); }
fclose ($sock);
return $cont;
}

for ($i=1; $i<10000; $i++)
{
$google = get_page($i);
while (strstr($google,"<font color=#008000>"))
{
$n1 = strpos("$google","<font color=#008000>")+20;
$google2=substr($google,$n1,strlen($google)-$n1);
$n2 = strpos($google2,"viewforum");
$url=substr($google2,0,$n2);
$google=substr($google,$n1+20,strlen($google)-$n1-20);
$url = strip_tags($url, "");

$f = fopen('./full.phpbb.txt', 'a+');
if (filesize('./full.phpbb.txt') > 0)
{
$tfile=fread($f,filesize('./full.phpbb.txt'));
}
else { $tfile = ""; }
if (!strstr($tfile,$url))
{
$count++;
fputs($f, "http://$url\n");
echo "<html><body><center>[$count]$url</center></body</html>";
}
fclose($f);
flush();
}
}

?>

Thursday, September 28, 2006

В помощь блогерам и всем кому понадобится

Посмотрев как некоторые мучаются когда постят скрипт в блоге, а он все нехочет писаться нормально . Написал для себя мелкий скриптик на PHP который заменяет < на &lt и тд. Пользуйтесь :в out.txt вставляем скрипт который мы хотим запихнуть в блог, а в out_clear.txt получаем версию скрипта который можно взять и спокойно вставить в блог без всяких последствий.:)

<?
$fl=fopen("out.txt","r");
$br=fread($fl,filesize("out.txt"));
$text=htmlspecialchars($br);
$write=fopen("out_clear.txt","a+");
fwrite($write,$text);
fclose($write);
echo $text;
?>

За спасибо приму пару ссылочек . :)

Wednesday, September 27, 2006

PHP Google PageRank Calculator Script

<?php
//original code is flanked with $$$$$$$$$

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// PHP Google PageRank Calculator Script
// -------------------------- April 2005
// Contact author: pagerankscript@googlecommunity.com

// for updates, visit:
// http://www.googlecommunity.com/scripts/google-pagerank.php

// provided by www.GoogleCommunity.com
// an unofficial community of Google fans
// ---------------------------------------

// Instructions
// Upload pagerank.php to your server
// Call it like this: http://www.example.com/pagerank.php?url=http://www.yahoo.com/
// example.com is your website. yahoo.com is the website to get the PR of
// The code below displays the PR for $url

/*
This code is released unto the public domain
*/
//header("Content-Type: text/plain; charset=utf-8");
define('GOOGLE_MAGIC', 0xE6359A60);

//unsigned shift right
function zeroFill($a, $b)
{
$z = hexdec(80000000);
if ($z & $a)
{
$a = ($a>>1);
$a &= (~$z);
$a |= 0x40000000;
$a = ($a>>($b-1));
}
else
{
$a = ($a>>$b);
}
return $a;
}

function mix($a,$b,$c) {
$a -= $b; $a -= $c; $a ^= (zeroFill($c,13));
$b -= $c; $b -= $a; $b ^= ($a<<8);
$c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
$a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
$b -= $c; $b -= $a; $b ^= ($a<<16);
$c -= $a; $c -= $b; $c ^= (zeroFill($b,5));
$a -= $b; $a -= $c; $a ^= (zeroFill($c,3));
$b -= $c; $b -= $a; $b ^= ($a<<10);
$c -= $a; $c -= $b; $c ^= (zeroFill($b,15));

return array($a,$b,$c);
}

function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
if(is_null($length)) {
$length = sizeof($url);
}
$a = $b = 0x9E3779B9;
$c = $init;
$k = 0;
$len = $length;
while($len >= 12) {
$a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
$b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
$c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
$mix = mix($a,$b,$c);
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
$k += 12;
$len -= 12;
}

$c += $length;
switch($len) /* all the case statements fall through */
{
case 11: $c+=($url[$k+10]<<24);
case 10: $c+=($url[$k+9]<<16);
case 9 : $c+=($url[$k+8]<<8);
/* the first byte of c is reserved for the length */
case 8 : $b+=($url[$k+7]<<24);
case 7 : $b+=($url[$k+6]<<16);
case 6 : $b+=($url[$k+5]<<8);
case 5 : $b+=($url[$k+4]);
case 4 : $a+=($url[$k+3]<<24);
case 3 : $a+=($url[$k+2]<<16);
case 2 : $a+=($url[$k+1]<<8);
case 1 : $a+=($url[$k+0]);
/* case 0: nothing left to add */
}
$mix = mix($a,$b,$c);
/*-------------------------------------------- report the result */
return $mix[2];
}

//converts a string into an array of integers containing the numeric value of the char
function strord($string) {
for($i=0;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}

function getrank($url) {
$url = 'info:'.$url;
$ch = GoogleCH(strord($url));
$file = "http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
$data = file($file);
$rankarray = explode (':', $data[2]);
$rank = $rankarray[2];
return $rank;
}
// PR of one URL from GET query
/*
echo 'PageRank: '.getrank($_REQUEST["url"]).'<br /><small>provided by <a href="http://www.googlecommunity.com/"
target="_blank">Google Community.com</a></small>';
*/
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$



if ($_POST['post']=='go_goo_go')
{
set_time_limit(0);
$urls = explode ("\n", $_POST['mes']);
echo "<h3>Results</h3>";
for ($i=0;$i<count($urls);$i++)
{
echo trim($urls[$i]).' PR '.getrank(trim($urls[$i]))."<BR>";
flush();
}

echo "<form method=post action=$SCRIPT_NAME>";
echo " <input type=submit name=post value='more'></form>";

}
else
{
echo '<table width="80%" border=1>';
echo "<tr><td><h3>URLs list</h3><form method=post action=$SCRIPT_NAME>";
echo " <textarea name=mes cols=80 rows=20></textarea><br>";
echo " <input type=submit name=post value='go_goo_go'></form> </td></tr>";
echo "</table>";
}


?>

Парсер MSN

<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8">
<form method="post" action="index.php">
<center>
<IMG title=MSN height=33 alt=MSN
src="logo.gif" width=84>
<font size="5" color="##02218A ">Parser







</font><br>
<input type="text" name="q" size="50">
<input type="submit" name="parse" value="search"/>
</center>
</form>
<a href="http://seo-script-archive.blogspot.com/">Seo Script Archive</a>
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
if ($_POST['parse']) {
parse();
}
function parse() {
//------------------Формируем URL------------------------//
$keys=file("pages.txt");
$probel=trim(str_replace(' ','%20',$_POST['q'])); // иначе курл матюкается "Bad Request"
$pages=str_replace('{KEY}',$probel,$keys);

//----------------Начинаем парсить-----------------------//
//$file=file($pages);
for ($s=0;$s<count($pages);$s++)
{
$ch = curl_init();//33
curl_setopt($ch, CURLOPT_URL, $pages[$s]); //парсим по сформированым URL'ам
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Widows NT)");
$headers = array("Cookie: SRCHHPGUSR=NEWWND=0&ADLT=OFF&NRSLT=100&NRSPH=1" ); //!!!
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
unset($file_content);
$file_content = curl_exec($ch);
//---------Ищим совпадения и выводим результат----------//

$matches = array();
preg_match_all("/<li class=\"first\">[^>]*<\/li>/U", $file_content, $matches);
for ($i=0; $i<count($matches[0]); $i++)
echo $matches[0][$i];
//flush();
}
}
?>

Создаем файл pages.txt и пишем в нем:
search.msn.com/results.aspx?q={KEY}
search.msn.com/results.aspx?q={KEY}&first=101
search.msn.com/results.aspx?q={KEY}&first=201

вот и все парсер готов.

Tuesday, September 26, 2006

Простенький скрипт для удаления повторов

Начал не со своих , так как они еще не закончены.
Простенький скрипт для удаления повторов

<?
$ty=file("out.txt");
echo count($ty).'<br>';
$gh=array_unique($ty);
foreach ($gh as $val)
{
$wf=fopen("out_clear.txt","a+");
fwrite($wf,$val);
fclose($wf);
}
echo count($gh).'<br>';
?>
смысл скрипта: Берется текстовый файл с кейвордами (или чем другим ) out.txt , проганяется и в файле out_clear.txt сохраняются только уникальные кейворды .
Google
 
Web seo-script-archive.blogspot.com