Пример #1
0
function pagerank($url, $proxies = false, $ind = 0)
{
    if ($proxies === null) {
        $proxies = array('163.125.97.101:8888', '110.164.65.19:8080', '200.75.51.151:8080', '163.125.99.177:9999', '103.28.115.41:8080', '201.75.2.74:8080', '110.170.137.26:80', '190.232.45.32:8080');
    }
    //for ($i=0;$i<count($proxies);$i++){
    if (!isset($url) || $url === '') {
        return '';
    }
    $request = 'http://' . PAGERANK_SERVER_URI . '/tbr?client=navclient-auto&ch=' . checkSum($url) . '&features=Rank&q=info:' . $url;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $request);
    curl_setopt($ch, CURLOPT_USERAGENT, PAGERANK_USER_AGENT);
    curl_setopt($ch, CURLOPT_FAILONERROR, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if ($proxies !== false && ($i = mt_rand($ind, count($proxies) - 1)) > -1) {
        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
        curl_setopt($ch, CURLOPT_PROXY, $proxies[$i]);
    }
    //curl_setopt($ch, CURLOPT_PROXY, $proxies[$i]);
    curl_setopt($ch, CURLOPT_TIMEOUT, PAGERANK_SERVER_TIMEOUT);
    $result = curl_exec($ch);
    if ($error = curl_error($ch)) {
        echo "Received error when querying pagerank server" . (isset($i) && $i > -1 ? " with proxy {$proxies[$i]}" : '') . ":\n {$error}\n";
        if (!isset($i) || $i < 0) {
            echo "Maybe too many requests? Waiting 3610 seconds before continuing...\n";
            sleep(3610);
            echo "resuming process...\n";
        }
    }
    //}
    if (empty($result)) {
        return -1;
    }
    return intval(substr($result, strrpos($result, ':') + 1));
}
Пример #2
0
			if ($v > 10) {
				$val += ($v % 10) + 1;
			} else {
				$val += $v;
			}
		}
	}
	//Now take sum of digits and times by 9
	$sum = $val * 9;
	//last digit is your checkSum.
	if ($digit) {
		return $acc.substr($sum,-1);
	} else {
		return substr($sum,-1);
	}
}
$accountNum = "10241";//"15971";
$amount = "20000";
if (isset($_REQUEST['a'])) {
	$accountNum = $_REQUEST['a'];
}
if (isset($_REQUEST['amount'])) {
	$amount = $_REQUEST['amount'];
}
$checkSum = checkSum($accountNum);
print "account = $accountNum, checkSum = " . $checkSum ."\n";

//second checksum...
$sum2 = checkSum($checkSum.$amount,false);
print "sum2 = " . $sum2 . "\n";
?></pre>