content-length: HTTP1.0 ok., but HTTP1.1, virtual hosts?

From: Date: Wed, 26 Jul 2000 15:11:27 +0000
Subject: content-length: HTTP1.0 ok., but HTTP1.1, virtual hosts?
Groups: php.dev 
Request: Send a blank email to php-dev+get-26310@lists.php.net to get a copy of this message
Hi there, this is the code to retrieve the content-length on given item. Unfortunately I had no success using virtual hosts or HTTP1.1. Could sb. lend his helping brain? :) regards Example with file on local server, php.net and heavy.com... <?php include('dao/package.IOSocket.php'); function &content_length($server,$path,$port=80) { $io = new IOSocket($server,$port); $io->open(); $io->send("GET $path HTTP/1.0\n"); $io->send("Host: $server\n\n"); while (($tmp=$io->readline())) { if (stristr($tmp,'Content-Length')) $ret=trim(substr($tmp,15)); } $io->close(); return $ret; } ?>local: <?php echo content_length('localhost','/attachment.txt'); ?><BR>heavy.com: <?php echo content_length('www.heavy.com','/'); ?><BR>php.net: <?php echo content_length('www.php.net','/'); ?> -- o----------0-¬---------O-·---¬----o---®-----o o O ° . | http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ ° · 0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © ° . · | psychedelic experience | gott@kiffen.de | O ° o ° o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·

« previous php.dev (#26310) next »