I want to read from a file (a file off a website) into an array.
I want each element of the array to contain one line from this text website.
How do I populate the array?
| SitePoint Sponsor |



I want to read from a file (a file off a website) into an array.
I want each element of the array to contain one line from this text website.
How do I populate the array?





Use file()
http://www.php.net/file
Example
PHP Code:names.txt
==========
Harry
Bob
Lisa
Mary
<?
$data = file("names.txt");
foreach($data as $key => $val) {
print "$val<br>";
}
?>
Please don't PM me with questions.
Use the forums, that is what they are here for.
Bookmarks