On Tue, 4 Feb 2003, The New Source wrote: > How can I get a certain line from a file? > > If I get a file in this way: > > $f = fopen("http://www.url.com/index.htm","r"); > > How can I get a certain line of the file index.htm? > > I would need to get the line number 232, or lines from 232 to 238. How > can I get this content?
Either loop through it with fgets() or simply use file() and use the required array elements (lines). Most likely using fopen/fgets() will be more efficient as you won't need every line but file() is just so easy to use. Although really this problem doesn't sound very efficient to begin with, you may want to rethink the logic here or ask your content provider for a RSS version of the content or something... See: http://www.php.net/file http://www.php.net/fgets Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php