It's not hard at all to write code to connect to an IRC server and do a whois and connect, you just open a socket connection to the server and port you would normally connect to, then using fputs() you just print the raw IRC commands and then have a little while loop that would grab the contents of the whois and disconnect, I have some basic code below, I am lazy so there are no comments but i'm sure you'll see what i was doing as it is very simple, it basically connects and gets the first 100 lines and disconnects, just a basic demo of how your code would work.
<?
$server = "thepeel.inside3d.net";
$port = "6667";
$nickname = "GeEk";
$passwd = "";
$realname = "warren";
$channel = "#geek-mag";
$host = "UNIX";
$ident = "gmdotcom";
$irc = fsockopen($server, $port);
If(!irc) {
echo("Error Connecting");
exit;
}
fputs($irc, "USER $ident $host $server :$realname\n\r");
fputs($irc, "NICK $nickname\n\r");
if(!passwd) {
echo("No Password Is Set... Skipping Password\n");
}
else{
fputs($irc, "PRIVMSG nickserv identify $passwd\n\r");
}
fputs($irc, "JOIN $channel\n\r");
fputs($irc, "WHOIS mel_gibson\n\r");
while ($count < 20) {
$buffer = fgets($irc, 1024);
echo($buffer);
$ping = explode(" ", $buffer);
if ($ping[0] == "PING") {
say("PONG $ping[1]");
}
else {
if ($ping[0] == "ERROR") {
say("QUIT");
exit;
}
}
$count++;
}
?>