Okay, your making a simple whois program and you are taking a long code? do this (you have to have /usr/local/bin/whois):

$result = `/usr/local/bin/whois www.mydomain.com`;

There you go, now $result is your result. NOTE: Please do not include the http:// in the URL.