[advanced search]
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 04-07-2006, 10:08 AM   · #1
sacx13
NamePros Regular
 
Trader Rating: (8)
Join Date: Mar 2006
Posts: 394
NP$: 286.68 (Donate)
sacx13 is on a distinguished road
Lightbulb PHP4 script to get Alexa Traffic Rankings

The primarly code was found on: http://www.checkurl.info

Code:
function Alexa($domain) { //define vars $return = 0; $serviceURL = 'http://awis.amazonaws.com/onca/xml'; $service = "AlexaWebInfoService"; $operation = "UrlInfo"; $timestamp = gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()); // Timestamp format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z' $signature = ''; $secretAccessKey = 'YOUR SECRET KEY'; $signature = urlencode(calculate_RFC2104HMAC($service.$operatio n.$timestamp,$secretAccessKey)); $timestamp = urlencode($timestamp); // construct the query $q = '?Service='.$service .'&AWSAccessKeyId=YOUR PUBLIC KEY' .'&Operation='.$operation .'&ResponseGroup=Rank' .'&Url=www.'.$domain .'&Timestamp='.$timestamp .'&Signature='.$signature; // get the xml results $fetchURL = $serviceURL.$q; if(!$xml = @file_get_contents($fetchURL)) { $file = @file($fetchURL); $xml = implode("", $file); } // echo $xml; // if the result was invalid, meaning API key expired if(strstr('<IsValid>False</IsValid>', $xml)) { $xml = '<Rank>-1</Rank>'; } // find the rank preg_match('/\<Rank\>(\d+)\<\/Rank\>/', $xml, $result); $return = $result[1]; // return the results return "$return"; } function calculate_RFC2104HMAC ($data, $key) { return base64_encode ( pack("H*", sha1((str_pad($key, 64, chr(0x00)) ^(str_repeat(chr(0x5c), 64))) . pack("H*", sha1((str_pad($key, 64, chr(0x00)) ^(str_repeat(chr(0x36), 64))) . $data)))) ); }

How to use:

Code:
$apr=Alexa("namepros.com"); echo "Alexa Rank for namepros.com is: ".$apr."<br>";


Regards
Adrian

P.S. Any NP$ is welcome
P.P.S. Any problem write me on PM or here in forum


Please register or log-in into NamePros to hide ads
sacx13 is offline   Reply With Quote
Old 04-07-2006, 10:42 AM   · #2
santro
Account Closed
 
Trader Rating: (0)
Join Date: Dec 2005
Posts: 20
NP$: 0.65 (Donate)
santro is an unknown quantity at this point
Thanks for the script! A pretty good one!
santro is offline   Reply With Quote
Old 04-08-2006, 05:52 AM   · #3
sacx13
NamePros Regular
 
Trader Rating: (8)
Join Date: Mar 2006
Posts: 394
NP$: 286.68 (Donate)
sacx13 is on a distinguished road
I just maked work... The script is not made by me.

Regards
sacx13 is offline   Reply With Quote
Old 04-08-2006, 04:26 PM   · #4
Tree
NamePros Regular
 
Tree's Avatar
 
Name: Trevor
Location: Atlanta, GA, USA
Trader Rating: (3)
Join Date: Feb 2006
Posts: 334
NP$: 0.00 (Donate)
Tree will become famous soon enoughTree will become famous soon enough
What is the secret key?
__________________
NCIDev.com
Tree is offline   Reply With Quote
Old 04-08-2006, 04:35 PM   · #5
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,268
NP$: 1152.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Originally Posted by Tree
What is the secret key?


AWS developer's key - https://aws-portal.amazon.com/gp/aw...tion/index.html
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.3 now available!!
SecondVersion is offline   Reply With Quote
Old 04-09-2006, 11:02 AM   · #6
Tree
NamePros Regular
 
Tree's Avatar
 
Name: Trevor
Location: Atlanta, GA, USA
Trader Rating: (3)
Join Date: Feb 2006
Posts: 334
NP$: 0.00 (Donate)
Tree will become famous soon enoughTree will become famous soon enough
Guess I'll have to get me one of those.
__________________
NCIDev.com
Tree is offline   Reply With Quote
Old 04-09-2006, 12:51 PM   · #7
stscac
A Wealth of Knowledge
 
stscac's Avatar
 
Trader Rating: (45)
Join Date: Aug 2004
Posts: 3,787
NP$: 2800.20 (Donate)
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
If people need a simple solution, you can query:

Originally Posted by query
http://www.stscac.com/dev/alexa/?url=x

x = http://www.domain.com or http://domain.com or domain.com



For those of you who want the rank without having to worry about any code or the bulky alexa site.

-Steve
stscac is offline   Reply With Quote
Old 04-09-2006, 10:59 PM   · #8
webbist101
Account Closed
 
Trader Rating: (1)
Join Date: Dec 2005
Posts: 109
NP$: 0.00 (Donate)
webbist101 is an unknown quantity at this point
Originally Posted by stscac
If people need a simple solution, you can query:
http://www.stscac.com/dev/alexa/?url=x

For those of you who want the rank without having to worry about any code or the bulky alexa site.

-Steve



That's cool you set this up. Newbie developers could use file_get_contents with that URL if they wanted a checker or something. Here's an example for PHP-illiterate folks of how to use this in their scripts.

<?
if (isset($_POST['submit'])) {
$str = file_get_contents("http://www.stscac.com/dev/alexa/?url=".$_POST['url']);
$str = trim($str);
echo "Rating for ".$_POST['url']." is ".$str;
}
else
{
?>
<form name="alexarate" method="post" action="<?=$_SERVER['PHP_SELF']; ?>">
Get Alexa Rating For:
<input type="text" name="url" value="http://"> <input type="submit" name="submit" value="Get Rating!">
</form>
<?
}
?>
webbist101 is offline   Reply With Quote
Old 04-09-2006, 11:03 PM   · #9
weblord
www.1weblord.com
 
weblord's Avatar
 
Name: William R. Nabaza - williamrnabaza.com
Location: Philippines - www.Nabaza.com
Trader Rating: (244)
Join Date: Dec 2005
Posts: 21,398
NP$: 21635.83 (Donate)
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
Autism Protect Our Planet
there are also versions that doesn't require AWS developer's key
__________________
★★★ ESTIBOT.COM Free Domain Appraisal, Keyword Tools, Available Domains ★★★
PHP Link Directory Script phpLD Templates Category Dump
♥♥Clean Toolbar♥♥
I DNKitchen.com and Chef Patrick ---> Domain News

weblord is offline  
  Reply With Quote
Old 04-09-2006, 11:05 PM   · #10
webbist101
Account Closed
 
Trader Rating: (1)
Join Date: Dec 2005
Posts: 109
NP$: 0.00 (Donate)
webbist101 is an unknown quantity at this point
Originally Posted by weblord
there are also versions that doesn't require AWS developer's key



I'm sure you can develop your own API that communicates with the Alexa site directly. I might script up something for the users at NP when I'm not so tired
webbist101 is offline   Reply With Quote
Old 04-09-2006, 11:49 PM   · #11
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,268
NP$: 1152.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Originally Posted by weblord
there are also versions that doesn't require AWS developer's key


Yep
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.3 now available!!
SecondVersion is offline   Reply With Quote
Old 04-09-2006, 11:51 PM   · #12
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
Thanks for this script, i know you didnt make it but i will give you rep for finding it.
Xyzer is offline   Reply With Quote
Old 04-10-2006, 10:43 AM   · #13
stscac
A Wealth of Knowledge
 
stscac's Avatar
 
Trader Rating: (45)
Join Date: Aug 2004
Posts: 3,787
NP$: 2800.20 (Donate)
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
Originally Posted by webbist101
Originally Posted by stscac
If people need a simple solution, you can query:
http://www.stscac.com/dev/alexa/?url=x

For those of you who want the rank without having to worry about any code or the bulky alexa site.

-Steve



That's cool you set this up. Newbie developers could use file_get_contents with that URL if they wanted a checker or something. Here's an example for PHP-illiterate folks of how to use this in their scripts.

<?
if (isset($_POST['submit'])) {
$str = file_get_contents("http://www.stscac.com/dev/alexa/?url=".$_POST['url']);
$str = trim($str);
echo "Rating for ".$_POST['url']." is ".$str;
}
else
{
?>
<form name="alexarate" method="post" action="<?=$_SERVER['PHP_SELF']; ?>">
Get Alexa Rating For:
<input type="text" name="url" value="http://"> <input type="submit" name="submit" value="Get Rating!">
</form>
<?
}
?>


That's the reason I did it. I remember when I was a rather newbie when it came to web development, and I do remember people helping out and helping me learn different functions through examples.

I figure that some people will not be able to understand the code in the first example, I'll make it a little more bearable for them.

I'm not asking for anything at this time, but just let me know what site you're pulling the data to so I can keep track.



-Steve
stscac is offline   Reply With Quote
Old 04-10-2006, 03:03 PM   · #14
webbist101
Account Closed
 
Trader Rating: (1)
Join Date: Dec 2005
Posts: 109
NP$: 0.00 (Donate)
webbist101 is an unknown quantity at this point
Originally Posted by stscac
That's the reason I did it. I remember when I was a rather newbie when it came to web development, and I do remember people helping out and helping me learn different functions through examples.

I figure that some people will not be able to understand the code in the first example, I'll make it a little more bearable for them.

I'm not asking for anything at this time, but just let me know what site you're pulling the data to so I can keep track.



-Steve



Yeah, I can see this becoming a problem. However, I doubt many sites recieving any serious traffic would still use your system, as they would be on a high enough budget to afford developers to do this theirselves.
webbist101 is offline   Reply With Quote
Old 04-10-2006, 04:20 PM   · #15
stscac
A Wealth of Knowledge
 
stscac's Avatar
 
Trader Rating: (45)
Join Date: Aug 2004
Posts: 3,787
NP$: 2800.20 (Donate)
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
Originally Posted by webbist101
Yeah, I can see this becoming a problem. However, I doubt many sites recieving any serious traffic would still use your system, as they would be on a high enough budget to afford developers to do this theirselves.


I figured this much. But for those who do use it, just drop me a line.

-Steve
stscac is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Hunting Moon RealTechNetwork EscrowDNS
Advertise your business at NamePros
All times are GMT -7. The time now is 10:31 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0