PHP
  Home arrow PHP arrow Page 6 - Using PHP classes to navigate distribu...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Using PHP classes to navigate distributed whois databases
By: Mark Jeftovic
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    1999-12-07

    Table of Contents:
  • Using PHP classes to navigate distributed whois databases
  • Overview of the whois landscape
  • Making sense of it with PHP classes
  • Overview of Whois2.php
  • Looking at the pieces
  • Tying it all together
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using PHP classes to navigate distributed whois databases - Tying it all together


    (Page 6 of 7 )


    When all is said and done, and you simply want to look up pretty wellany domain name in your PHP scripts, you simply need do this:

    $whois = new Whois("devshed.com"); $result = $whois->Lookup();
    Depending on what we have under the hood as far as extended handlersgo, $result would contain:

    In the case of no extended handlers:

    $result["rawdata"]
    will contain an array of the raw output from the whois server.

    In the case of a .com/.net/.org domain with *NO* registrar handler:

    $result["regyinfo"]
    will contain parse key/value pairs of the registry output, including an array of "nameservers" and

    $result["rawdata"]
    will contain the unparsed raw output from the whois server defined in $result["regyinfo"]["whois"]

    ....and in the case of a .com/.net/.org/.edu that has a registrar handler you'll have the two as above plus $result["regrinfo"] which will be an array with key/value pairs from the registrar whois server.

    To see exactly what we have in our $result or any parts therein wecan use the handy-dandy showObject() function in utils.whois, which is bundled for debugging and diagnostics purposes (along with a coupleof other goodies.)

    So, to lookup devshed.com and then examine the actual object we get backwe can do this:

    $whois = new Whois("devshed.com"); $result = $whois->Lookup(); include( "utils.whois"); $display = new utils; $display->ShowObject($result);
    And the final result is:
    A $result["regyinfo"] array with all the registry info, note thatthe nameserver list itself another array in $result["regyinfo"]["nameserver"]:

    regyinfo->Array domain->DEVSHED.COM registrar->NETWORK SOLUTIONS, INC. whois->whois.networksolutions.com referrer->www.networksolutions.com nameserver->Array 0->NS1.INFOWEST.COM 1->NS2.INFOWEST.COM
    A $result["rawdata"] array that has the raw data from the registrar'swhois server.

    rawdata->Array 0->The Data in Network Solutions' WHOIS database is provided by Network 1->Solutions for information purposes, and to assist persons in obtaining 2->information about or related to a domain name registration record. 3->Network Solutions does not guarantee its accuracy. By submitting a 4->WHOIS query, you agree that you will use this Data only for lawful 5->purposes and that, under no circumstances will you use this Data to: 6->(1) allow, enable, or otherwise support the transmission of mass 7->unsolicited, commercial advertising or solicitations via e-mail 8->(spam); or (2) enable high volume, automated, electronic processes 9->that apply to Network Solutions (or its systems). Network Solutions 10->reserves the right to modify these terms at any time. By submitting 11->this query, you agree to abide by this policy. 12-> 13->Registrant: 14->InfoWest Global Internet Services, Inc. (DEVSHED-DOM) 15-> 1845 W. Sunset Blvd. 16-> St. George, UT 84770 17-> US 18-> 19-> Domain Name: DEVSHED.COM 20-> 21-> Administrative Contact: 22-> Cosby, David R (DRC4) dcosby@INFOWEST.COM 23-> 801.674.0165 24-> Technical Contact, Zone Contact: 25-> Gifford, Aaron D (AG44) agifford@INFOWEST.COM 26-> 435-674-0165 (801) 634-9567 (FAX) 435-674-9654 27-> Billing Contact: 28-> InfoWest Domain Services (IDS2-ORG) dns@INFOWEST.COM 29-> 435-674-0165 30->Fax- 435-674-9654 31-> 32-> Record last updated on 06-Aug-1997. 33-> Record created on 06-Aug-1997. 34-> Database last updated on 6-Dec-1999 16:08:49 EST. 35-> 36-> Domain servers in listed order: 37-> 38-> NS1.INFOWEST.COM 204.17.177.10 39-> NS2.INFOWEST.COM 204.17.177.20 40->
    And finally a $result["regrinfo"] array, because we have a "netsol" handler to parse output from the Network Solutions registrar serverwe have the following data:

    regrinfo->Array organization->InfoWest Global Internet Services, Inc. org_handle->DEVSHED-DOM org_address->1845 W. Sunset Blvd. St. George, UT 84770 US domain->DEVSHED.COM admin->Array name-> Cosby, David R handle->DRC4 email->dcosby@INFOWEST.COM tech->Array name-> Gifford, Aaron D handle->AG44 email->agifford@INFOWEST.COM billing->Array name-> InfoWest Domain Services handle->IDS2-ORG email->dns@INFOWEST.COM updated->06-Aug-1997 created->06-Aug-1997 db_updated->6-Dec-1999 16:08:49 EST ns->Array NS1.INFOWEST.COM->204.17.177.10 NS2.INFOWEST.COM->204.17.177.20
    At the time of writing the only extended handler for registrar's is the netsol class. We need further classes for register.com, melbourneIT,COREnic and all the other registrars. Until then, our output would havestopped with the $result["rawdata"] array above.

    Another Example:

    Looking up something other than a domain name:

    $STRING = "MJ177"; require("whois2.php3"); $whois = new Whois(); $whois->Query["server"]="whois.networksolutions.com"; $result = $whois->Lookup($STRING);
    $STRING in this case is a Network Solutions contact handle (mine). It could just as easily be a host handle or any other string. The registrarwhois servers at NetSol allow wildcard matching on arbitrary strings.

    More PHP Articles
    More By Mark Jeftovic


     

       

    PHP ARTICLES

    - Using Aliases and the Autoload Function with...
    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Sub Classing Exceptions in PHP 5
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT