Building a WHOIS page in PHP?

You know, just a page with a form on it. Type in a domain, it returns WHOIS details.

How would you do this? I’ve got no idea… Should I just Google up some pre-coded PHP thing?