PHP
  Home arrow PHP arrow Page 4 - PHP Networking
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

PHP Networking
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2008-09-08


    Table of Contents:
  • PHP Networking
  • DNS and PHP
  • DNS and PHP continued
  • Getting information about a domain name

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    PHP Networking - Getting information about a domain name
    ( Page 4 of 4 )

    When looking at a domain name as part of a email address or URL, you simply do not get enough information from it. You can even go so far as visiting that URL and you still will not have enough information about the ownership of that particular domain. Most of the kind of information that you would want will be located in a WHOIS database. These databases are maintained by registrars and can provide information about the owners of a particular domain. To get the information from these databases you need to run a whois query from a client application. PHP provides this kind of client application through the PEAR package.

    PEAR has a class that enables you to query a whois database. This class is called Net_Whois. And is used like so:


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title>Untitled Document</title>

    </head>


    <body>

    <?

    require_once "Net/Whois.php";

    $server = "whois.networksolutions.com";

    $query = "metroworks.com";

    $whois = new Net_Whois;

    $urlinfo = $whois->query($query, $server);

    var_dump($urlinfo);

    ?>

    </body>

    </html>


    First the code defines the server where the whois database is located:


    $server = "whois.networksolutions.com";


    Then it defines the name of the domain on which it wants to run a query:


    $query = "metroworks.com";


    Finally the query is run, after the Net_whois class is instantiated:


    $whois = new Net_Whois;

    $urlinfo = $whois->query($query, $server);


    and the information from the query is shown:


    var_dump($urlinfo);

    The var_dump() function will show the entire contents of the $urlinfo variable.

    Next week we will go over more PHP tools and functions that are useful in a network environment. 



     
     
    >>> More PHP Articles          >>> More By David Web
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek