vn
Share code hiện Rank Alexa và VN cho JohnCMS
Thứ Hai, 6 tháng 5, 2013
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='.$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='.$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://eviet.mobi');
echo ' & VN: '.alexa_rankvn('http://eviet.mobi');
Xem phiên bản web
alexa,cho,code,Code center,hiện,johncms,rank,share,và,vn
2013-05-06T21:09:00-07:00
2013-05-06T21:09:00-07:00
Đang tải dữ liệu...
Không có nhận xét nào:
Đăng nhận xét
‹ Bài đăng Mới hơn
Bài đăng Cũ hơn ›
Trang chủ
Không có nhận xét nào:
Đăng nhận xét