Tekil Mesaj gösterimi
  #1 (permalink)  
Alt 12-02-2007, 13:43:23
SNaRe - ait Kullanıcı Resmi (Avatar)
SNaRe SNaRe isimli üyemiz çevrimdışıdır. (Offline)
Webmaster
No Status
 
Üyelik tarihi: 31/1/2007
Yaş: 22
Mesajlar: 378
iTrader: (0)
Tecrübe Puanı: 60
Puanları: 394
SNaRe has a spectacular aura aboutSNaRe has a spectacular aura about
Standart PHP'yle Alexa Sıralamasını Çekme

Daha önce bununla ilgili adam gibi kod bulamamıştım. Bu kod sayesinde alexa sıralamasını çekebilirsiniz
PHP- Kodu:
<?php
    
function getPage ($url) {
        if (
function_exists('curl_init')) {
            
$ch curl_init($url);
            
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
            
curl_setopt($chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);
            return 
curl_exec($ch);
        } else {
            return 
file_get_contents($url);
        }
    }
    function 
getAlexaRank($url) {
        
$url = @parse_url($url);
        
$url $url['host'];
        
$url "http://data.alexa.com/data?cli=10&dat=s&url=$url";
        
$data $this->getPage($url);
        
preg_match('#<POPULARITY URL="(.*?)" TEXT="([0-9]+){1,}"/>#si'$data$p);
        
$value = ($p[2]) ? number_format($p[2]) : 0;
        return 
$value;
    }
?>
Fonksiyonu çağırmak için yapacağınız tek şey aşağıdaki kodu çalıştırmak
PHP- Kodu:
<?php
    
echo getAlexaRank ('http://www.google.com');
?>
Kolay gelsin
__________________
BEN MEVLANA DEĞİLİM ADAM OL ÖYLE GEL
Alıntı ile Cevapla