Results 1 to 7 of 7
Hybrid View
-
8th Feb 2012, 11:50 AM #1OPBannedWebsite's:
Seecure.me[PHP] GetAlexaTrafficRank
[PHP] GetAlexaTrafficRank
Pass through a domain without 'www' in "$domain". Read, Learn, Modify, Re-use.
Example output:
Code:
Code:<?php /** * This is simple description. * * @author Vick Kumar <vickkumar2011@gmail.com> * @copyright Seecure.me, 2012 * @version 1.0 * @license http://creativecommons.org/licenses/by/3.0/legalcode */ function GetAlexaTrafficRank($domain) { $source = file_get_contents("http://www.alexa.com/siteinfo/$domain#"); $regex = '/is ranked (.*) in/'; preg_match($regex, $source, $match); $newresult = str_replace("number", "", $match[1]); return $newresult; } echo "Seecure.ME's Alexa Traffic Rank is: ".GetAlexaTrafficRank("seecure.me")."."; ?>
_Vick Reviewed by _Vick on . [PHP] GetAlexaTrafficRank GetAlexaTrafficRank Pass through a domain without 'www' in "$domain". Read, Learn, Modify, Re-use. Example output: http://screensnapr.com/e/uOxR3O.jpg Code: <?php Rating: 5
-
8th Feb 2012, 11:53 AM #2MemberWebsite's:
Elite.SO Defendos.com Motionite.comPHP Code:<?php
/**
* This is simple description.
*
* @author Vick Kumar <vickkumar2011@gmail.com>
* @copyright Seecure.me, 2012
* @version 1.0
* @license http://creativecommons.org/licenses/by/3.0/legalcode
*/
$domain = 'besthostingforums.com';
function GetAlexaTrafficRank($domain)
{
$source = file_get_contents("http://www.alexa.com/siteinfo/$domain#");
$regex = '/is ranked (.*) in/';
preg_match($regex, $source, $match);
$newresult = str_replace("number", "", $match[1]);
return $newresult;
}
echo $domain." 's Alexa Traffic Rank is: ".GetAlexaTrafficRank($domain).".";
?>
Easier for them noobs.
-
8th Feb 2012, 12:01 PM #3OPBannedWebsite's:
Seecure.me^ Won't work due to $domain is passed via function, not set outside of function etc.
-
8th Feb 2012, 12:04 PM #4MemberWebsite's:
Elite.SO Defendos.com Motionite.comYeah, but it will work if you have the $domain variable in your code.
Goodjob btw
-
8th Feb 2012, 12:06 PM #5MemberPHP Code:
function GetAlexaTrafficRank($domain) {
$domain = preg_replace('#(https?://)?(www\.)?#i','',$domain);
...
-
8th Feb 2012, 01:05 PM #6Respected MemberWebsite's:
DL4Everything.com Soft2050.inThe Regex failed
PHP Code:<?php
/**
* This is simple description.
*
* @author Vick Kumar <vickkumar2011@gmail.com>
* @copyright Seecure.me, 2012
* @version 1.0
* @license http://creativecommons.org/licenses/by/3.0/legalcode
*/
function GetAlexaTrafficRank($domain)
{
$source = file_get_contents("http://www.alexa.com/siteinfo/$domain#");
$regex = '/is ranked (.*) in/';
preg_match($regex, $source, $match);
$newresult = str_replace("number", "", $match[1]);
return $newresult;
}
echo "KWWHunction's Alexa Traffic Rank is: ".GetAlexaTrafficRank("besthostingforums.com").".";
?>
Fix the regex
-
8th Feb 2012, 06:45 PM #7Member
http://www.alexa.com/siteinfo/besthostingforums.com
The rank is calculated using a combination of average daily visitors to
besthostingforums.com and pageviews on besthostingforums.com over the past 3 months. The site with the highest combination of visitors and pageviews is ranked #1.
Here's a fix:
PHP Code:function GetAlexaTrafficRank($domain)
{
$source = file_get_contents("http://www.alexa.com/siteinfo/$domain#");
$regex = '#([0-9,]+)\s*</div>\s*<div class="label">Global Rank#';
preg_match($regex, $source, $match);
$newresult = str_replace("number", "", $match[1]);
return $newresult;
}
echo "KWWHunction's Alexa Traffic Rank is: ".GetAlexaTrafficRank("besthostingforums.com").".";
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
themaLeecher - leech and manage...
Version 4.93 released. Open older version (or...