|
|||
WhoIs Server and fsockopen(...) in PHP[BACK]Any Software Engineer or a Computer gcience graduate will know what sockets are. They are an important part of communications that can be established between two computers over a public or private domain. It is through these sockets that some domain registrars will make available information about the domain publishers that are available on the public domain (www). The servers that provide this information in this way are called Who Is servers. These servers have a common URL so that they can be located on the public domain very easily. And also there is specific structure for those URLs. They often will be like, whois.domainname.com or whois.domainname.net / .org. Some very commonly available who is servers are whois.networksolutions.com, whois.internic.net. Sockets are like interfaces that sit between the computer and the public network (i.e., the intranet or internet). These are the communication ports between computers. Any computer that needs to communicate with any other computer in this world needs to communicate through these sockets. These are like electricity sockets to which we plug-in our electrical gadgets. We will consume electricity only by taking supply from those sockets. The same analogy applies to computers and data. They are the ports through which data can be transferred to-and-fro from the computer. A server can have as many sockets as it can provide; It depends on the capability of the server. However, in general, sockets range lies between 0 and 65,535. In this first 256 ports (or sockets) are for internal use, like for webserver, mail server, file server, etc. A WhoIs server communicates through socket number 43. This is the port number which listens to requests made to that server about WhoIs information of domains. The fsockopen(...) in PHP: PHP is a very versatile and easy to use general purpose language, although it is mainly used for web-scripting. PHP provides a function called fsockopen(...) through which a communication channel can be established between the Who Is server and the webserver on which our PHP script runs. The procedure is very simple.
while(!feof($fileHandler)) { $rawData=fread($fileHandler, 256); $easyData=explode("\n", $rawData); $size=count($easyData); // find total number of lines for($i=0; $i<$size; $i++) print "{$easyData[$i]}<br>"; }
With this in place on your mind, now you should be able to write your own script which can read information about a particular domain. But you should be aware and cautious about the permissions that are available to you before you attempt to read. Also you should be aware of the authenticity and warranty that particular who is servers provide. A who is server along with information about a domain, also provides a copytight message with it for you to refer. So, you can certainly have a try. Go to my websites WhoIs page to know information about a particular domain. You can find information about .com, .net and .edu domains only. Good Luck. V Rama Aravind 27-08-2005. |
|||
|