Handshake, check for empty string

If curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);, then $res will return empty string. The exception should be thrown if it fails to handshake, thus also checking for empty string.

http://www.php.net/manual/en/function.curl-exec.php#70123