reading from file

From: Date: Wed, 25 Jul 2001 20:34:54 +0000
Subject: reading from file
Groups: php.general 
Request: Send a blank email to php-general+get-59602@lists.php.net to get a copy of this message
I am using the script include below to read the content of a file and output it. When I load this script with the adress of a plain html file it outputs everything like expected, except there are some extra characters spread over the file. They come in little string like '40d' or '1000' and appear on positions where there is 'nothing' in the original source file. Any idea what could cause that behavior? Stefan <? $myServer = 'xxx.xxx.xxx.xx'; $document = 'index.shtml'; $fp=fsockopen($myServer,80,&$errno,&$errstr,30); $request = "GET $document HTTP/1.1\r\nAuthorization: Basic "; $request .= base64_encode("xxxxxx:xxxxxx") . "\r\n"; $request .= "Host: $myServer\r\n\r\n"; if(!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs($fp,$request); while(!feof($fp)) { $line=fgets($fp,4096); echo $line; } fclose($fp); } ?>

« previous php.general (#59602) next »