<?php
$filepath = "C:/data.txt";
$p_start = 1;
$p_end = 10;
$fl = fopen($filepath,"a");
if(!$fl)
{
print "file not found";
die();
}
for($page = $p_start;$page < $p_end;$page++)
{
Sleep(2);
$header = "GET /ratings/users?page=".$page." HTTP/1.1\r\n";
$header .= "Host: www.livejournal.ru\r\n";
$header .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; uk; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7\r\n";
$header .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
$header .= "Accept-Language: uk,ru;q=0.8,en-us;q=0.5,en;q=0.3\r\n";
$header .= "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
$header .= "Connection: keep-alive\r\n\r\n";
$sckt = fsockopen("www.livejournal.ru",80);
fputs($sckt,$header);
while(!feof($sckt))
{
$serv_answer = fgets($sckt,2048);
if($s = strstr($serv_answer,"fn nickname"))
{
$n = strpos($s,"live");
$dat = substr($s,30,$n - 31);
fputs($fl,$dat."\n");
print $dat."\n";
}
if($s = strstr($serv_answer,"</html>"))
break;
}
fclose($sckt);
}
print "Done";
fclose($fl);
?>