Jump to content

How to obtain the list of files in a URL?


lopes_andre

Recommended Posts

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,

 

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/");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.