heh... I said it wasn't perfect....
If you run that script, it connects to irc.fef.net (EFNet network). The expected result from irc.fef.net is:
NOTICE AUTH :*** Processing connection to einstein.fef.net
NOTICE AUTH :*** Looking up your hostname...
NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Found your hostname
NOTICE AUTH :*** No Ident response
ERROR :Closing Link: 127.0.0.1 (Client Exit)
So my code just checks to see if (1) it connects to the domain and (2) that NOTICE AUTH is sent back. You'll have to know what is sent back to your browser/program from each server in order to get this working.
Here are a few:
irc.bolchat.org
NOTICE AUTH : Looking up your hostname...
NOTICE AUTH : Found your hostname
ERROR :Closing Link:
irc.ptnet.org
ERROR :Closing Link:
eu.undernet.org
NOTICE AUTH : Looking up your hostname
NOTICE AUTH : Checking Ident
NOTICE AUTH : Found your hostname
NOTICE AUTH : No ident response
:graz.at.Eu.UnderNet.org 451 * :Register first.
ERROR :Closing Link: by graz.at.Eu.UnderNet.org (Registration Timeout)
So I guess you could look for NOTICE AUTH or ERROR because if it's error, then the server is online, but the PHP script can't connect to it. In that case, on the line that has eregi() in it, the "NOTICE AUTH.$" part should be changed to:
"NOTICE AUTH|ERROR.$"
That should work for the most part. But as I said, you'd need to know what the server is sending back so you can look for it and determine of the server is online or offline.