PHP - Domain Tools Class
This is a domain class I wrote today which has the functions of:
GetRegistrar
GetWhoisServer
GetUpdatedDate
GetCreationDate
GetExpirationDate
It's easy to read, learn, and use.
I used file_get_contents rather than curl as curl is not enabled on all hosts, but a majority of them and plus I would of only used curl if I had wanted to increase speed, and flexibility.
PHP Source:
<?php /** * @author Vick@CoderzSpot.com * @website www.CoderzSpot.com * @version 1.0 * @date(25-10-2011) * @contact vick@hotmail.com.au **/ class Domain{ function GetRegistrar($url) { $output = file_get_contents("http://new.whois.net/whois/$url"); $regex = '/Registrar: (.+?) Whois/'; preg_match($regex, $output, $match); echo "Registrar: ".$match[1]; } function GetWhoisServer($url) { $output = file_get_contents("http://new.whois.net/whois/$url"); $regex = '/Whois Server: (.+?) Referral/'; preg_match($regex, $output, $match); echo "Whois Server: ".$match[1]; } function GetUpdatedDate($url) { $output = file_get_contents("http://new.whois.net/whois/$url"); $regex = '/Updated Date: (.+?) Creation/'; preg_match($regex, $output, $match); echo "Updated Date: ".$match[1]; } function GetCreationDate($url) { $output = file_get_contents("http://new.whois.net/whois/$url"); $regex = '/Creation Date: (.+?) Expiration/'; preg_match($regex, $output, $match); echo "Creation Date: ".$match[1]; } function GetExpirationDate($url) { $output = file_get_contents("http://new.whois.net/whois/$url"); $regex = '/Expiration Date: (.+?) /'; preg_match($regex, $output, $match); $substr = substr($match[1], 0, -11); echo "Expiration Date: ".$substr; } } $domain = new Domain(); $domain->GetRegistrar("coderzspot.com"); $domain->GetWhoisServer("coderzspot.com"); $domain->GetUpdatedDate("coderzspot.com"); $domain->GetCreationDate("coderzspot.com"); $domain->GetExpirationDate("coderzspot.com"); ?>
-
Tim Brownlaw -
Thanks
{{ DiscussionBoard.errors[4955007].message }} -
-
mmstud -
Thanks
{{ DiscussionBoard.errors[4955460].message }} -
-
pfreelancer -
Thanks
{{ DiscussionBoard.errors[4965478].message }} -
-
wasabi20 -
Thanks - 1 reply
{{ DiscussionBoard.errors[5025791].message }}-
megazord100 -
Thanks
{{ DiscussionBoard.errors[5037719].message }} -
-