Some questions about file_get_contents
View Single Post
07-24-2009, 06:51 PM
Join Date: Apr 2007
Ok, a few points.
The line with fopen() is doing absolutely nothing useful in that script. It is the call to the file() function that brings in the file, fopen isn't needed.
To use file_get_contents to grab a file just use
$content = file_get_contents($filename);
along with that third line. That will do what the code snippet you showed does.
You're wanting to parse CSV data please don't try and do it manually: PHP has a built-in function called
or it is super-easy to use
(see the 2nd example in particular).
View Public Profile
Send a private message to Salathe
Visit Salathe's homepage!
Find More Posts by Salathe