phpList.org

Export list from command line

I’ve seen a couple references to exporting lists from the command line, but I can’t find any specific documentation about whether this is possible and, if so, how to do it.

I found one example and tried that with a couple lists, one pretty small and one with a few thousand people. The output from the first (smaller) one was just the column headers / field names, the output from the larger one was the headers plus one subscriber record. Nothing about that one record stood out to me as a reason it would have been selected while the rest weren’t.

Just for background, this is for one piece of a home-baked ETL process. I’m getting subscriber data from another source and importing that into phpList after some manipulation, but I want to avoid importing anyone already in the database for two specific lists. I’ve been manually exporting the existing-subscriber data for those lists using Advanced search, and my code uses that (CSV) data to exclude existing subscribers from the import set. This is cumbersome to do frequently (e.g., daily). My ultimate goal is to have hands-off automation handle everything, so I want to script the export of subscriber data from those two lists.

FWIW, I did look at using the REST API for what I’m trying to do, but I didn’t find what I needed.

@Crenel84 It is similar to other command line pages with an optional list id parameter

php /path/to/phplist/admin/index.php -p export -c /path/to/phplist/config/config.php [-l 99]

Thanks for the prompt reply. That’s what I used, with the results as noted. I’ll take a fresh look at it tomorrow to see if I can figure out if I did something wrong, but at this point it looks like a no-go for me.

The only difference I could see was the order of arguments, so I moved the list parameter to the end. Same result (including the same subscriber record in the file that did get one record).

Not sure why exporting from the command line doesn’t work for me, but I’ve had other weird “doesn’t work for me” issues with phpList. I guess I’ll plod along with the manual search/export process for now, and maybe someday tackle reading the database directly from my other code.