note 28930 added to function.file

From: Date: Tue, 28 Jan 2003 12:11:43 +0000
Subject: note 28930 added to function.file
Groups: php.notes 
Request: Send a blank email to php-notes+get-42920@lists.php.net to get a copy of this message
The below example posted by Dan - predicted_loser(at)msn.com should NOT be used! To get the contents of a remote file into a string... <?php $line = file("http://example.com"); foreach($line as $nline){ $content="$content$nline"; } echo $content; ?> Use <? $content=join("\n",file("http://example.com")); echo $content; ?> or as of PHP 4.3 <? $content=file_get_contents("http://example.com"); echo $content; ?> -- http://www.php.net/manual/en/function.file.php http://master.php.net/manage/user-notes.php?action=edit+28930 http://master.php.net/manage/user-notes.php?action=delete+28930 http://master.php.net/manage/user-notes.php?action=reject+28930

« previous php.notes (#42920) next »