PHP Whois Function

Posted on 2008-10-20
Last Modified: 2013-12-13

Am developing a web hosting project, i just wanna confirm how domain name whois information is written in PHP.
Question by:nitation
LVL 26

Expert Comment

ID: 22755846

Author Comment

ID: 22756120
None of the both is working. One error to the other.

Accepted Solution

MatthiasVance earned 500 total points
ID: 22758867
I hope this helps you.

Kind regards,

Matthias Vance


	function whois($query, $server) {

		$socket = fsockopen($server, 43, $errno, $errstr, 10);

		if(!$socket) {

			return false;


		fwrite($socket, $query . "\r\n");

		$response = "";

		while(!feof($socket)) {

			$response .= fgets($socket, 1024);



		return $response;


	echo whois("", "");


Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now