PHP5's get_headers is very useful because it can directly read the information of remote files without reading the entire file to the server. But now many web servers do not support php5. Let's take a look at an example class about php4 getting the file size of the remote server.
php tutorial 4 how to get the remote file size class
/*
PHP5 has get_headers which is very useful because it can directly read the information of the remote file without reading the entire file to the server. But now many web servers do not support php5. Let's take a look at an example class about php4 getting the file size of the remote server.
*/
if(!function_exists('get_headers'))
If(preg_match('/^([a-za- z -]+): +(.*)$/',$i,$parts))
{
function get_headers($url,$format=0)
{
$ url=parse_url($url);
url = parse_url($url); ['port']), $errno, $errstr, 30);
if ($fp)
{
$out = "get / http/1.1rn";
$out .= "host: ".$url['host']."rn";
. ;
while (!feof($fp))
{
$var.=fgets($fp, 1280);
if(strpos($var,$end))
break ;
}
rn",$var);
if($format)
{
foreach($var as $i)v,
http://www.bkjia.com/PHPjc/444899.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/444899.html
TechArticle
php5 has get_headers which is very useful because it can directly read the information of the remote file without reading the entire file. Get the server. But now many web servers do not support php5, below...