Web traffic checker by GiGz

ljuskaArchive
//archivePosts: 37Member, Moderator in PHP
<?php
//GiGZ@Ljuska.ORG
set_time_limit(0);
$sites = file('lista.txt');

foreach($sites as $site) {
$filter =  array('http://','http://www.','www.');
$url = str_ireplace($filter,"",$site);
$link = "www.$url";
$fu = CheckDomain($link);
$gdays = get_str($fu, "getting","pageviews");
$gupdate = get_str($fu,"updated","Days");
$txt = "\n $link [-] Daily visits:$gdays";

if(strpos($fu,'Today')) {
echo "[x] <b>".$link."</b> [-] Visits per day: <b>".$gdays."</b> [+] Last updated Today<br />";
$op = fopen("traffic.txt", 'a');
fwrite($op,$txt);
fclose($op);
}
else if(strpos($fu,'Yesterday')) {
echo "[x] <b>".$link."</b> [-] Visits per day: <b>".$gdays."</b> [+] Last updated Yesterday<br />";
$op = fopen("traffic.txt", 'a');
fwrite($op,$txt);
fclose($op);
}
else if($gdays) {
$op = fopen("traffic.txt",'a');
fwrite($op,$txt);
fclose($op);
echo "[x] <b>".$link."</b> [-] Visits per day: <b>".$gdays."</b> [+] Last updated ".$gupdate." days ago<br />";
}
else {
echo "[x] <b>".$link."</b> [-] Page doesn't exist!<br />";
}
}

function get_str($str, $pocetak, $kraj){
$str = " ".$str;
$find = strpos($str,$pocetak);
if ($find == 0) { return ""; }
else {
$find += strlen($pocetak);
$len = strpos($str,$kraj,$find) - $find;
return substr($str,$find,$len);
} }

function CheckDomain($domain)
{
$timeout = 5;
$useragent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';
$fields = array(
'website'=>urlencode($domain),
'Submit'=>urlencode("Calculate")
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
$crl = curl_init();
curl_setopt ($crl,CURLOPT_POST,count($fields));
curl_setopt ($crl,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt ($crl, CURLOPT_USERAGENT, $useragent);
curl_setopt ($crl, CURLOPT_URL,"http://websiteoutlook.com//getdata.php");
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($crl, CURLOPT_FOLLOWLOCATION, true);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}

?>

USAGE
lista.txt => site po liniji

OUTPUT
[x] www.ljuska.org [-] Visits per day: 1738 [+] Last updated 26 days ago

Sign In or Register to comment.

Welcome

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions