phpgoogle-app-enginequercus

parse remote csv-file with PHP on GAE


I seem to be in a catch-22 with a small app I'm developing in PHP on Google App Engine using Quercus;

  1. I have a remote csv-file which I can download & store in a string
  2. To parse that string I'd ideally use str_getcsv, but Quercus doesn't have that function yet
  3. Quercus does seem to know fgetcsv, but that function expects a file handle which I don't have (and I can't make a new one as GAE doesn't allow files to be created)

Anyone got an idea of how to solve this without having to dismiss the built-in PHP csv-parser functions and write my own parser instead?


Solution

  • I think the simplest solution really is to write your own parser . it's a piece of cake anyway and will get you to learn more regex- it makes no sense that there is no csv string to array parser in PHP so it's totally justified to write your own. Just make sure it's not too slow ;)