Share Code Hiện RankAlexa Và VN Cho JohnCMS
Cái này VN4EVER share, mình sửa lại vài cái
nay không dùnng share lại cho ae
Dán code này vào chỗ muốn hiển thị, end.php chẳng hạn
function alexa_rank($diachi) {
$u = 'http://data.alexa.com/data?cli=10&dat=s&url='.a>$diachi;
$link = $u;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_NOBODY, $header);
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$content = curl_exec($ch);
curl_close($ch);
if(preg_match('', $content, $alexa_rank)) {
return $alexa_rank[1];
}
}
function alexa_rankvn($diachi) {
$u = 'http://data.alexa.com/data?cli=10&dat=s&url='.a>$diachi;
$link = $u;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_NOBODY, $header);
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$content = curl_exec($ch);
curl_close($ch);
if(preg_match('', $content, $alexa_rankvn)) {
return $alexa_rankvn[1];
}
}
echo 'Alexa: '.alexa_rank('http://domain');a>
echo ' & VN: '.alexa_rankvn('http://domain');a>
$u = 'http://data.alexa.com/data?cli=10&dat=s&url='.a>$diachi;
$link = $u;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_NOBODY, $header);
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$content = curl_exec($ch);
curl_close($ch);
if(preg_match('', $content, $alexa_rank)) {
return $alexa_rank[1];
}
}
function alexa_rankvn($diachi) {
$u = 'http://data.alexa.com/data?cli=10&dat=s&url='.a>$diachi;
$link = $u;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_NOBODY, $header);
curl_setopt($ch, CURLOPT_URL, $u);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$content = curl_exec($ch);
curl_close($ch);
if(preg_match('', $content, $alexa_rankvn)) {
return $alexa_rankvn[1];
}
}
echo 'Alexa: '.alexa_rank('http://domain');a>
echo ' & VN: '.alexa_rankvn('http://domain');a>
các bạn sửa domain thành tên wap của bạn nhé. hi