Hi Leute,
Versuche mit einen Script ob eine Datei auf einen Server verfügbar ist.
Funktioniert mit folgenden Quellcode :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Symtec Development Studio 1.1a">
<title>Document Title</title>
</head>
<body>
<?php
function url_header($url) {
$url = preg_replace('#^http:#i', '', $url);
if (preg_match('#^//#', $url)){
list(,,$domain, $file) = explode('/', $url, 4);
$file = "/$file";
} else {
$file = $url;
if (! preg_match('#^/#', $file)) $file = "/$file";
$domain = $_SERVER[HTTP_HOST];
}
$fid = fsockopen($domain, 80);
if (! $fid) return "Host not responding";
fputs($fid, "HEAD $file HTTP/1.0\r\nHost: $domain\r\n\r\n");
$head = fread($fid, 4096);
fclose($fid);
echo " \n<pre>\n$head<pre>";
return $head;
}
function url_exists($url) {
return preg_match('#^HTTP/.*\s+200\sOK\s#i', url_header($url));
}
?>
<?
url_exists("http://www.speichern.0catch.com/OPF/Apache_002.zip")
?>
</body>
</html>
[COLOR=red]aber:[/COLOR] wie kann ich die folgende Ausgabe auf
Content-Length: 867162
und
ob die Datei da ist reduzieren ??
zur Zeit wird folgendes Angezeigt:
HTTP/1.0 200 OK
Date: Wed, 07 May 2003 07:15:20 GMT
Server: Apache/1.3.20 (Unix) mod_gzip/1.3.19.1a mod_perl/1.26
Last-Modified: Tue, 19 Nov 2002 05:56:48 GMT
Expires: Thu, 15 Apr 2010 20:00:00 GMT
Content-Length: 867162
Content-Type: application/zip
X-Cache: MISS from squid1.0catch.com
Connection: close
Versuche mit einen Script ob eine Datei auf einen Server verfügbar ist.
Funktioniert mit folgenden Quellcode :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Symtec Development Studio 1.1a">
<title>Document Title</title>
</head>
<body>
<?php
function url_header($url) {
$url = preg_replace('#^http:#i', '', $url);
if (preg_match('#^//#', $url)){
list(,,$domain, $file) = explode('/', $url, 4);
$file = "/$file";
} else {
$file = $url;
if (! preg_match('#^/#', $file)) $file = "/$file";
$domain = $_SERVER[HTTP_HOST];
}
$fid = fsockopen($domain, 80);
if (! $fid) return "Host not responding";
fputs($fid, "HEAD $file HTTP/1.0\r\nHost: $domain\r\n\r\n");
$head = fread($fid, 4096);
fclose($fid);
echo " \n<pre>\n$head<pre>";
return $head;
}
function url_exists($url) {
return preg_match('#^HTTP/.*\s+200\sOK\s#i', url_header($url));
}
?>
<?
url_exists("http://www.speichern.0catch.com/OPF/Apache_002.zip")
?>
</body>
</html>
[COLOR=red]aber:[/COLOR] wie kann ich die folgende Ausgabe auf
Content-Length: 867162
und
ob die Datei da ist reduzieren ??
zur Zeit wird folgendes Angezeigt:
HTTP/1.0 200 OK
Date: Wed, 07 May 2003 07:15:20 GMT
Server: Apache/1.3.20 (Unix) mod_gzip/1.3.19.1a mod_perl/1.26
Last-Modified: Tue, 19 Nov 2002 05:56:48 GMT
Expires: Thu, 15 Apr 2010 20:00:00 GMT
Content-Length: 867162
Content-Type: application/zip
X-Cache: MISS from squid1.0catch.com
Connection: close
Kommentar