求怎样解决fsockopen函数,错误
<?<br />//获取文件大小<br />function remote_filesize($url_file){<br /> if (!remote_file_exists($url_file)) return false;<br /> $headInf = get_headers($url_file,1);<br /> return $headInf['Content-Length'];<br />}<br />//判断文件是否存在<br />function remote_file_exists($url_file){ <br /> $url_file = trim($url_file);<br /> if (empty($url_file)) return false;<br /> $url_arr = parse_url($url_file);<br /> if (!is_array($url_arr) || empty($url_arr)) return false;<br /> $host = $url_arr['host'];<br /> $path = $url_arr['path'] ."?".@$url_arr['query'];<br /> $port = isset($url_arr['port']) ?$url_arr['port'] : "80";<br /> $fp = fsockopen($host, $port, $err_no, $err_str,30);<br /> if (!$fp) return false;<br /> $request_str = "GET ".$path." HTTP/1.1\r\n";<br /> $request_str .= "Host:".$host."\r\n";<br /> $request_str .= "Connection:Close\r\n\r\n";<br /> fwrite($fp,$request_str);<br /> //fread replace fgets<br /> $first_header = fread($fp, 128);<br /> fclose($fp);<br /> if (trim($first_header) == "") return false;<br /> //check $url_file "Content-Location"<br /> if (!preg_match("/200/", $first_header) || preg_match("/Location:/", $first_header)) return false;<br /> return true;<br />}<br />echo remote_filesize("http://wlm212.bjphp1.qq1.cc/down/ee.exe");<br />?><br />