[Resolved] In need of assistance

SpaceshipSpaceship
Watch

Barrucadu

Established Member
Impact
64
In need of assistance

I am working on a site statistics script (link here), but cant figure out how to get the domains age, or expiration date. How would I get that information?
Also, if you look at the site and think of some important thing it needs, please tell me.

PS: It takes a few minutes to get all the stats, so don't close your browser.
edit: The loading time shouldnt be so much of a problem now, due to some ajax magic I just added (ooh, my first ajax thing :))
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
That information is available on a whois so you could either scrape the information from another site or do a whois lookup yourself and use a regular expression to extract the information.
 
0
•••
Well, i've got it all working. If anyone has any feature ideas, now would be the time :)
 
0
•••
seems to be fine for .com but tried a .co.uk (in fact a couple) and the expiry and creation dates are left empty.
 
0
•••
Hmm, I can't seem to get it working for anything other than a .com, here are the functions:

PHP:
     function getCreated(){
          $url = $this->url['host'];
          $url = str_replace("www.", "", $url);
          $url = 'http://www.whois.ws/whois-com/ip-address/' . urlencode($url) . '/';
          $data = $this->getPage($url);
          $data = str_replace(" ", " ", $data);
          preg_match("#(Creation Date|Registered On):([\ ]+)([0-9a-zA-Z\-\ \:]+)(\r|\n)#si", $data, $p);
          $value = ($p[3]) ? $p[3] : '';
          return $value;
     }

     function getExpires(){
          $url = $this->url['host'];
          $url = str_replace("www.", "", $url);
          $url = 'http://www.whois.ws/whois-com/ip-address/' . urlencode($url) . '/';
          $data = $this->getPage($url);
          $data = str_replace(" ", " ", $data);
          preg_match("#(Expiration Date|Renewal date):([\ ]+)([0-9a-zA-Z\-\ \:]+)(\r|\n)#si", $data, $p);
          $value = ($p[3]) ? $p[3] : '';
          return $value;
     }
 
0
•••
The regular expression seems fine, are you sure that it is retrieving the page properly? try echoing out $data in a test.
 
0
•••
Got it! It turned out that the whois site had a different URL for different TLDs, so I had to change the url to the following:
PHP:
$ext = strrev($url);
$ext = explode(".", $ext);
$ext = strrev($ext[0]);
$url = 'http://www.whois.ws/whois-' . $ext . '/ip-address/' . urlencode($url) . '/';

Unfortunatly, the javascript seems to have stopped working, even though I haven't changed it...

Here are the contents of ajax.js, i've found the code stops at ajaxObject.send(null);
Code:
function ajaxFunction(){
     var xmlHttp;
     try{
          xmlHttp = new XMLHttpRequest();
     }
     catch (e){
          try{
               xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch (e){
               try{
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
               }
               catch (e){
                    return false;
               }
          }
     }
     return xmlHttp;
}

function getRequest(method, url){
     var ajaxObject;
     ajaxObject = ajaxFunction();
     
     if(ajaxObject){
          ajaxObject.open("GET", "http://mikor.clearlyhosted.org/Rank/data.php?act=" + method + "&url=" + url, true);
          ajaxObject.send(null);

          ajaxObject.onreadystatechange=function(){
               if(ajaxObject.readyState==4){
                    document.getElementById(method).innerHTML = ajaxObject.responseText;
               }
          }
     }else{
          alert("Sorry, your browser supports neither XMLHttpRequest(), Msxml2.XMLHTTP, nor Microsoft.XMLHTTP.\r\n\r\nAs a result, this page will not work.");
     }
}

edit: Fixed, I had to remove the http://mikor.clearlyhosted.org/Rank/ from the request url, it's just strange it worked before...
 
Last edited:
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back