NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Retrieving Alexa Ranking Programmatically?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-02-2006, 07:03 PM THREAD STARTER               #1 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)

Question Retrieving Alexa Ranking Programmatically?


Hey all,

I'm having a hard time trying to figure out how to get an Alexa ranking with PHP.

In the past I've been screen scraping but uh... lol they added new (and unfortunately) randomized HTML/XML tags between each digit in the ranking, so I can't grab it from scraping anymore.

I signed up with an Amazon Web Services (AWS) at http://aws.amazon.com but am still a bit confused...

Does anybody know how to do this?

Thanks,
-Matt
mholt is offline  
Old 02-02-2006, 07:24 PM   #2 (permalink)
tgo
NamePros Regular
Join Date: Aug 2005
Posts: 315
tgo is on a distinguished road
 



Can I ask why your screen scraping is not working anymore? I have my own screen scraper script in asp that is working just fine by reading the actual alexa page and getting the values. They have comment code just before the numbers you have to read, just look for that.

http://seohelp.info/alexarankings.asp

I haven't extensively tested this script with many domains, so I don't know if they all work, but from what I can tell its still possible to get the data.
tgo is offline  
Old 02-02-2006, 07:34 PM THREAD STARTER               #3 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Look at the source code, they've placed strange tags between the digits of the rankings. I always used to get the rankings properly but now when I go and try it, they come up "0" and I haven't changed anything.
mholt is offline  
Old 02-02-2006, 07:43 PM   #4 (permalink)
tgo
NamePros Regular
Join Date: Aug 2005
Posts: 315
tgo is on a distinguished road
 



Heh I never noticed this change, my code seams to have been immune to their code change. My page puts all those useless code parts in my page too, but since they do nothing they dont display. I grab all the data between The TD tags.

I do a search on the page for "Alexa Web Information Service.-->"

When found, I grab everything between the following TD tags, which inclues all the useless code. Since the useless code doesnt display in a browser, It just displays the numbers.
tgo is offline  
Old 02-02-2006, 08:11 PM THREAD STARTER               #5 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Ah... maybe I should remove the number formatting functions (custom ones, I guess I'll live w/o them)... I don't want excess code in the source either but I guess these random tags won't matter...

Well, thanks, I'll see what happens tomorrow when I work on it.
mholt is offline  
Old 02-02-2006, 08:24 PM   #6 (permalink)
tgo
NamePros Regular
Join Date: Aug 2005
Posts: 315
tgo is on a distinguished road
 



With this now brought to my attention I think by just converting the text gathered and converting it to numeric only values may eliminate the extra code. I will test that later and see if I can rid myself of the crazy code.

Or just code in a remove all tags function to remove any and all tags from the retrieved data between the TD tags. Should not be hard, its just looking for "<" and ">" in the extracted text and removing all text in between.
tgo is offline  
Old 02-02-2006, 08:45 PM THREAD STARTER               #7 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Yeah, that's hard, but there's numbers inside the < and > characters... but yeah I should try a strip_tags function and see if that helps: But they aren't standard HTML tags... hmm..

I'll figure this out sooner or later
mholt is offline  
Old 02-02-2006, 08:55 PM   #8 (permalink)
tgo
NamePros Regular
Join Date: Aug 2005
Posts: 315
tgo is on a distinguished road
 



Gota think outside the box.

You are thinking of looking for the tags specificaly. This is not how to make a strip tags function.

First you look for a "<" then find the next time you see ">" and delete, then do it again, until you dont find anymore "<"

All the weird tags start with a "<" and end with a ">" so if you know you dont want anything in between these two things its fairly easy to remove the elements in a small loop.
????: NamePros.com http://www.namepros.com/programming/163938-retrieving-alexa-ranking-programmatically.html

I dont know PHP but in asp this is easy as I just grab the info between the TD tags, put it in a temp variable, then remove all tags function that returns the value without any tags.
tgo is offline  
Old 02-02-2006, 09:03 PM THREAD STARTER               #9 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
It's similar in PHP... thanks
mholt is offline  
Old 02-14-2006, 04:27 PM   #10 (permalink)
col
NamePros Regular
 
col's Avatar
Join Date: Jan 2005
Location: Land of the m00
Posts: 729
col is just really nicecol is just really nicecol is just really nicecol is just really nice
 



Just fetch the number like mentioned above, with all the mumbojumbo tags included. Then just use strip_tags($string_with_mumbojumbo_tags) to clean it up.
I guess you've already found out a way to fix this, but I just wanted to put up a solution at the end of the thread if someone, like I just did, tries to find the answer here in the forum
__________________
The more I think
the more confused I get...
col is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleted Domain List Site FREE dropscripts For Sale / Advertising Board 12 09-24-2003 08:16 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:42 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger