note 17320 added to function.file

From: Date: Tue, 04 Dec 2001 15:04:23 +0000
Subject: note 17320 added to function.file
Groups: php.notes 
Request: Send a blank email to php-notes+get-21603@lists.php.net to get a copy of this message
the example above in the manual doesn't work: <br><?php // get a web page into an array and print it out $fcontents = file ('http://www.php.net'); while (list ($line_num, $line) = each ($fcontents)) { echo "<b>Line $line_num:</b>; " . htmlspecialchars ($line) . "<br>\n"; } // get a web page into a string $fcontents = join ('', file ('http://www.php.net')); ?> <br><br> it displays following errors:<br><br> Warning: php_hostconnect: connect failed in /home/ratioma/web/koolitus/hrkoolitus/home/new.php on line 3<br><br> Warning: file("http://www.php.net") - Bad file descriptor in /home/ratioma/web/koolitus/hrkoolitus/home/new.php on line 3<br><br> Warning: Variable passed to each() is not an array or object in /home/ratioma/web/koolitus/hrkoolitus/home/new.php on line 4<br><br> Warning: php_hostconnect: connect failed in /home/ratioma/web/koolitus/hrkoolitus/home/new.php on line 9<br><br> Warning: file("http://www.php.net") - Bad file descriptor in /home/ratioma/web/koolitus/hrkoolitus/home/new.php on line 9<br><br> Warning: Bad arguments to join() in /home/ratioma/web/koolitus/hrkoolitus/home/new.php on line <br><br> -- http://www.php.net/manual/en/function.file.php http://master.php.net/manage/user-notes.php?action=edit+17320 http://master.php.net/manage/user-notes.php?action=delete+17320 http://master.php.net/manage/user-notes.php?action=reject+17320

« previous php.notes (#21603) next »