I am trying to make a website that uses fopen to open up text file. Something like this http://somesite.com/readarticle.php?name=sample.txt
<?php
$file = 'sample.txt';
$f = fopen($file, r);
while ( $line = fgets($f, 1000) ) {
print $line;
}
?>
The sample.txt is located on the web server, I was able to make this work but my problem now is how do I use the same php file on opening other text file without specifying filename on the php file itself?
Something like this..
http://somesite.com/readarticle.php?name=sample.txt
http://somesite.com/readarticle.php?name=sample2.txt
http://somesite.com/readarticle.php?name=sample3.txt
Sorry for my bad english..:)