Neler yeni

Foruma hoş geldin 👋, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.

  • Forumdan daha fazla yararlanmak için, profilinizi telefon numaranız 📱 ile doğrulayın ve daha ayrıcalıklı olun 😉
    Daha fazla bilgi!

Nasıl yapılır ? Php Alexa'dan nasıl veri çekilir

MustafaseveR

xFanatik
SMS onaylı
Kullanıcı
Katılım
19 May 2019
Mesajlar
545
Çözümler
64
Arkadaşlar bu kodları localhosta deniyorum şuan kulandıgım sitenin rankını gösteriyor ama siteye upload edince rankları 0 olarak gösteriyor bu sorunu nasıl çözerim. Kodlar çalişiyor ama rankları 0 olarka gösteriyor tek sorun bu localhostta denedigimde normal şekilde rankımı gösteriyor.

Kod:
<?php
$url = 'https://www.X.com';
$alexa = simplexml_load_file('http://data.alexa.com/data?cli=10&url=' . $url);

$globalRank = number_format((int)$alexa->SD->POPULARITY['TEXT']);

$countryCode = $alexa->SD->COUNTRY['CODE'];
$countryName = $alexa->SD->COUNTRY['NAME'];

$countryRank = number_format((int)$alexa->SD->COUNTRY['RANK']);

echo "Global Rank: " . $globalRank;
echo '<hr />';
echo "Country Rank: " . $countryName . ' ' . $countryRank;

?>

Kod:
<iframe src="https://X.com/alexa.php"></iframe>

Localhost WebSite upload
Localhost -- UploadWeb
 
Son düzenleme:
Birde böyle dener misin bende çalıştı

PHP:
<?php
$site ="xenforo.gen.tr";
function AlexaRank($domain, $country, $mode) {
    $url = "https://www.alexa.com/minisiteinfo/".$domain;
    $string = file_get_contents($url);
    if ($mode == "country") {
        $temp_s = substr($string, strpos($string, $country." Flag") + 9 + strlen($country));
        return(substr($temp_s, 0, strpos($temp_s, "</a></div>")));
    }
    else if ($mode == "global") {
        $temp_s = substr($string, strpos($string, "Global") + 38);
        return(substr($temp_s, 0, strpos($temp_s, "</a></div>")));
    }
    else {
        return('Ters giden birşey mi var.');
    }
}

echo "Dünya: ".AlexaRank("$site", "Turkey", "global");
echo '<hr />';
echo "Türkiye: ".AlexaRank("$site", "Turkey", "country");
?>
 
Birde böyle dener misin bende çalıştı

PHP:
<?php
$site ="xenforo.gen.tr";
function AlexaRank($domain, $country, $mode) {
    $url = "https://www.alexa.com/minisiteinfo/".$domain;
    $string = file_get_contents($url);
    if ($mode == "country") {
        $temp_s = substr($string, strpos($string, $country." Flag") + 9 + strlen($country));
        return(substr($temp_s, 0, strpos($temp_s, "</a></div>")));
    }
    else if ($mode == "global") {
        $temp_s = substr($string, strpos($string, "Global") + 38);
        return(substr($temp_s, 0, strpos($temp_s, "</a></div>")));
    }
    else {
        return('Ters giden birşey mi var.');
    }
}

echo "Dünya: ".AlexaRank("$site", "Turkey", "global");
echo '<hr />';
echo "Türkiye: ".AlexaRank("$site", "Turkey", "country");
?>
Sağolun hocam sorunsuz teşekkürler.
 

Foruma hoş geldin 👋, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.