lopes_andre Posted December 20, 2010 Share Posted December 20, 2010 Hi, I need to read files from a web directory. I have tested the "opendir" function but it doesn't work. <?php if ($handle = opendir('http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV')) { echo "Directory handle: $handle\n"; echo "Files:\n"; /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir($handle))) { echo "$file\n"; } /* This is the WRONG way to loop over the directory. */ while ($file = readdir($handle)) { echo "$file\n"; } closedir($handle); } ?> How can I read files from a directory like this? Best Regards, Quote Link to comment Share on other sites More sharing options...
johnny86 Posted December 20, 2010 Share Posted December 20, 2010 echo file_get_contents("http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV"); Quote Link to comment Share on other sites More sharing options...
menator Posted December 20, 2010 Share Posted December 20, 2010 You might want to have a look at scandir Quote Link to comment Share on other sites More sharing options...
lopes_andre Posted December 20, 2010 Author Share Posted December 20, 2010 Hi, "file_get_contents" has done the job. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.