[SOLVED] possible array problem.
Posted: Tue Jan 04, 2005 4:20 pm
Im trying to view information stored in just .txt files on a server, as well as count the number of rows in each .txt file... place the row number beside the row of information.. etc. this is what i have but only the last record in the locations.txt file is showing up.. locations.txt being the where the URL to all the files are. this is the code..
so in my locations.txt file it looks this
http://myserver.com/folder1/text1.txt
http://myserver.come/folder2/text2.txt
http://myserver.come/folder3/text3.txt
only http://myserver.come/folder3/text3.txt
returns data..
i get this error with the others
Warning: file(http://myserver.come/folder2/text2.txt ): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /folder/count2.php on line 5
which causes problems with the foreach functions..
Anyone know?
Code: Select all
$Array = file("locations.txt");
for ($x=0; $x < count($Array); $x++) {
echo $Array[$x] . "\n";
$lines = file("$Array[$x]");
echo "<table border=1><tr><td>\n";
foreach ($lines as $line_num => $line) {
echo "<a name=".$line_num."><a href="#".$line_num."">".$line_num."</a><br>\n";
}
echo "</td><td>\n";
foreach ($lines as $line_num => $line) {
echo $line."<br />\n";
}
echo "</td></tr></table>\n";
}
?>http://myserver.com/folder1/text1.txt
http://myserver.come/folder2/text2.txt
http://myserver.come/folder3/text3.txt
only http://myserver.come/folder3/text3.txt
returns data..
i get this error with the others
Warning: file(http://myserver.come/folder2/text2.txt ): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /folder/count2.php on line 5
which causes problems with the foreach functions..
Anyone know?