Replaced fsockoen with stream_socket_client, added timeout as constructor parameter