I think somebody else may have beaten me to it, but I figured I would post these for everybody's reference anyways. Basically, these scripts establish a backend which connects to battle.net and maintains the connection, parses packets, etc, and a frontend which users can view which establishes a connection with the backend to send and recieve chat. They are very sloppy so don't pick on me for messy code >< I made these a couple months ago and always intended to improve upon them and make things more user friendly, but never actually did anything so I decided to release it in its raw form to the public because I remember seeing a lot of posts requesting information on how to create a PHP Bot.
Anyways, here's the download link:
http://www.fapiko.com/index.php?page=Downloads&pn=2
Hope you don't have too much trouble figuring them out :p
Thanks! I'll take a look at it later. I was interested in making one a while back but it pretty much ate itself.