This is equivalent of question: Download CSV directly into Python CSV parser but in php. Basically I’m looking for a library offering interface capable of doing things I do with python just in a few lines of code:
h = httplib2.Http('.cache')
url = 'http://financials.morningstar.com/ajax/ReportProcess4CSV.html?t=' + code + '®ion=AUS&culture=en_us&reportType='+ report + '&period=12&dataType=A&order=asc&columnYear=5&rounding=1&view=raw&productCode=usa&denominatorView=raw&number=1'
headers, data = h.request(url)
return data
I need to download and parse csv file but I would like to avoid using cURL and its low level interface. Any suggestions?
Not quite 3 lines:
Or I guess you could use file_get_contents, if you REALLY don’t like cURL…
Also, take a look at str_getcsv() for converting the strings from the above functions into an array with data from the CSV file.