Simple socket wrapper for php