phpbar.de logo

Mailinglisten-Archive

[php] echte filesize von entfernten dateien

[php] echte filesize von entfernten dateien

Tobias fister22_(at)_hotmail.com
Sat, 5 Aug 2000 19:45:08 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_000D_01BFFF15.A902EAC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi
also alle einigerma=DFen verst=E4ndlichen FileSizeScripte funktionieren =
bei mir nicht, wie z.b.

function getfilesize($server, $filename){
  $fp =3D fsockopen($server,80,&$errno,&$errstr);
  if (!$fp) {
     echo "error $errstr ($errno)<br>\n";
  }
  else {
  fputs ($fp, "HEAD $filename HTTP/1.0\n\n");
    fputs($fp,"HEAD ".$filename." HTTP/1.0\nHost: ".$server."\n\n");
    while (!feof($fp)) {
         $test =3D sprintf("%s%s", $test, fgets ($fp,128));
    }
    print $test;
    if(strpos ($test, 'Content-Length:') > 0) {
          $pos =3D strpos ($test, 'Content-Length:');
          $pos2 =3D strpos ($test, 'Connection:');
          $size =3D substr($test, $pos + 15, $pos2 - $pos - 15);
          print $size;
    }

    fclose ($fp);
  }
  return $size;
}

liefert nur fehler ...
ich mu=DF es unbedingt hinbekommen da=DF ich die filegr=F6=DFe von =
zip=B4s, rar=B4s u.a. files auf allen m=F6glichen servern ( geocities, =
fortunecities,xoom ... ) auslesen kann oder zumindest bestimmen kann , =
ob die file =FCberhaupt existiert.

Wer hat da ein FUNZENDES Script ??

BIG THANKS

Tobias
Webmaster of Traffic-Eye ( http://cgi-bin.spaceports.com/~traffeye/ )



------=_NextPart_000_000D_01BFFF15.A902EAC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>also alle einigerma=DFen =
verst=E4ndlichen=20
FileSizeScripte funktionieren bei mir nicht, wie z.b.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>function getfilesize($server, =
$filename){<BR>&nbsp;=20
<A href=3D"file://$fp">$fp</A> =3D=20
fsockopen($server,80,&amp;$errno,&amp;$errstr);<BR>&nbsp; <A=20
href=3D"file://if">if</A> (!$fp) {<BR>&nbsp;&nbsp;&nbsp;&nbsp; echo =
"error $errstr=20
($errno)&lt;br&gt;\n";<BR>&nbsp; <A href=3D"file://}">}</A><BR>&nbsp; <A =

href=3D"file://else">else</A> {<BR>&nbsp;&nbsp;<A =
href=3D"file://fputs">fputs</A>=20
($fp, "HEAD $filename =
HTTP/1.0\n\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;fputs($fp,"HEAD=20
".$filename." HTTP/1.0\nHost:=20
".$server."\n\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;while (!feof($fp))=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $test =3D =
sprintf("%s%s",=20
$test, fgets=20
($fp,128));<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;print=
=20
$test;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(strpos ($test, 'Content-Length:') =
&gt; 0)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $pos =3D =
strpos=20
($test,=20
'Content-Length:');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
$pos2 =3D strpos ($test,=20
'Connection:');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 $size=20
=3D substr($test, $pos + 15, $pos2 - $pos -=20
15);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A=20
href=3D"file://print">print</A> =
$size;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;fclose =
($fp);<BR>&nbsp; <A=20
href=3D"file://}">}</A><BR>&nbsp; return $size;<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>liefert nur fehler ...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ich mu=DF es unbedingt hinbekommen =
da=DF ich die=20
filegr=F6=DFe von zip=B4s, rar=B4s u.a. files auf allen m=F6glichen =
servern ( geocities,=20
fortunecities,xoom ... ) auslesen kann oder zumindest bestimmen kann , =
ob die=20
file =FCberhaupt existiert.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Wer hat da ein FUNZENDES Script =
??</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>BIG THANKS</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Tobias</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Webmaster of Traffic-Eye ( <A=20
href=3D"http://cgi-bin.spaceports.com/~traffeye/">http://cgi-bin.spacepor=
ts.com/~traffeye/</A>=20
)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_000D_01BFFF15.A902EAC0--


php::bar PHP Wiki   -   Listenarchive