Friday July 19, 2024

Domain Expiration Notify Script

Date: 03/17/2005
Wayne Eggert

If you're in the web hosting business, a server admin, or heck.. just have too many domains at more registrars than you can shake a stick at, you might be worried that eventually you're going to miss re-registering an expiring domain. Most registrars will send an email or two when your domain's about to expire, but they don't go overboard to notify you. If you're not listed as a domain contact or your email address changes, you need another way to make sure the domains you're managing don't expire without giving you proper notification. This script will should help keep your fears at ease and hopefully give you proper notification of that impending doom that is domain expiration =)

Creating the Database
First up is to create the database table for the domain list. This isn't a very sophisticated setup -- there's no backend to manage things, so you will have to be good and aquainted with PHPMyAdmin.

CREATE TABLE `domains` (
`domainName` varchar(100) NOT NULL default '',
`registrar` varchar(100) NOT NULL default '',
`expiration` date NOT NULL default '0000-00-00',
`status` varchar(100) NOT NULL default '',
`lastChecked` timestamp(14) NOT NULL

Example of what to enter in this database table for each domain you want to check:
domainName - ""
registrar - "GoDaddy"
expiration - Leave Blank
status - Leave Blank
lastChecked - Leave Blank

page1 page2 page3 page4

no error but expiry date is not coming in database
Posted 03/19/11 4:26AM by leaftemp
no error all done, but no expiry date is coming in database i think this is because of wrong date format as on domain table default 0000-00-00 is different from the date format in whois server.

So please help me to correct my code.
Re: Expiration
Posted 09/21/09 6:17PM by AceBHound
Sounds like the $expiration string isn't getting built correctly. Before the SQL call to UPDATE the domains table, try echo'ing out the $expiration variable and see if it contains YEAR-MONTH-DAY (like 2009-12-31) or if it looks like "--". It's possible the WHOIS server you're using could be using a slightly different format and you'll need to adjust the code that parses out data from the WHOIS call.
Posted 09/15/09 4:52PM by Anonymous Techdoser
Great script, everything seems to work well except the expiration field in my database does not update.
Posted 08/14/09 12:21PM by thomascim
Hi Wayne, thanks very much for this useful code.

One suggestion is maybe adding an extra field to the database table for the extension.

This way you can also check domain extensions that have more or less than 3 characters like or .de, .eu, etc.

Thanks again,


problem with exec()
Posted 02/06/09 4:28PM by jschrader
I have installed the code, and am getting an error about the exec(), to be specific:

Warning: exec() has been disabled for security reasons in /home/a5704353/public_html/notify.php on line 38

Free Web Hosting

PHP Error Message

Warning: Invalid argument supplied for foreach() in /home/a5704353/public_html/notify.php on line 39

what is going on?
how to get the registrar
Posted 06/03/07 3:40PM by rocko
Hi, I see your script. It is really good and help me a lot.
But Im trying to use a registrar field. I use different string functions but I couldn't.
There are any way to use the registrar field?
Thanks in advance.
How to set cron tab
Posted 10/16/06 12:01AM by creativetest
How to set cron tab