Update: 25/9/08
Added socket error checking and added loads of $input. Also made the search function disable and enable the buttons according to text.