lopes_andre Posted December 17, 2010 Share Posted December 17, 2010 Hi, I'm automating a process of Inserting a CSV to a database. I'm doing it in PHP. I need to go to http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/ and get the list of the files in this directory. Which is the best way of doing it in PHP? Best Regards, Quote Link to comment Share on other sites More sharing options...
mikecampbell Posted December 17, 2010 Share Posted December 17, 2010 Do you have the DOM module installed? You can parse the returned HTML with it. Otherwise, you could use a regular expression. Quote Link to comment Share on other sites More sharing options...
lopes_andre Posted December 20, 2010 Author Share Posted December 20, 2010 Hi, I don't have DOM installed. This can't be done with cURL? Give me a clue. Best Regards, Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 20, 2010 Share Posted December 20, 2010 DOM is Windows-only, if you aren't on a windows box and/or if you care about portability. You could use curl, but imo that would be overkill. I would just use file_get_contents() and parse the HTML with regex. $page_html = file_get_contents("http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/"); 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.