Continuing my previous article ” Alexa Rank Checker Script with PHP “, In this article will combine the script, to check alexa rank from Flippa domain list.
For those who like to hunt domain on Flippa website, this script is useful to make it easier check alexa rank. The basic logic used to check the domain list on Flippa is scrap list domain and then check Alexa rank massively.
Here we go,
Download simple_html_dom parser to grab element from website, click here to download simple html dom.
1. Create script to scrap domain list from flippa, create php file as flippa-checker.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?php include "simple_html_dom.php"; echo ' <form method="post"> <table> <tr><td>URL </td><td> : <input type="text" name="url" size="60" /></td></tr> <tr><td>Page </td><td> : <input type="text" name="page" size="10" /></td></tr> <tr><td colspan=2><input type="submit" value="Submit" name="submit" /></td></tr>'; echo '</table></form>'; if (isset($_POST['submit'])) { $url=$_POST['url']; $cnt=$_POST['page']; for($x=1;$x<=$cnt;$x++) { $urlz=$url.'&page='.$x; $html = file_get_html($url); foreach($html->find('div[class=largetitle]') as $element) { foreach($element->find('a') as $jack) { echo $jack->plaintext . '<br>'; } } } } ?> |
1. Go to flippa.com, and check the domain you’re looking for
2. Please customized the domain options you’re looking for
3. Copy flippa url from browser and paste into your script
4. Click enter.
You will get a list of domain Flippa, Add the following script to check alexa rank on Flippa list domain.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | function get_rank($domain){ $url = "http://data.alexa.com/data?cli=10&dat=snbamz&url=".$domain; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($data); if($popularity = @$xml->xpath("//POPULARITY")) { $rank = number_format((string)$popularity[0]['TEXT']); }else { $rank = 'N/A'; } return $rank; } |
Change syntax
1 | echo $jack->plaintext . '<br>'; |
with
1 | echo $jack->plaintext.' -- >'.get_rank((string)trim($jack->plaintext)) . '<br>'; |
Done!, the tools will be display like below
Leave a Reply