Import lists from command line

HI!

is there any way to import lists via command line?

i have tried:

./bin/phplist -pimport

but i get only this…

phpList version 3.3.1 © 2000-2018 phpList Ltd, http://www.phplist.com
Usage: /var/www/html/lists/admin/index.php -p page [other parameters]

Thanks…

PetePot

@PetePot There must be something wrong with your phplist shell script because the command works for me.

php /home/duncan/www/lists/admin/index.php -p import -f /home/duncan/Downloads/import.csv -c /home/duncan/Development/PHP/phplist/config.php -l 1

But it then fails.

Error: Invalid security token, please reload the page and try again

Instead you can try the Subscribers plugin, to which I have added a command line page that uses the core phplist processing, see https://resources.phplist.com/plugin/subscribers#import_from_the_command_line

1 Like

Thanks a lot Duncan… i will try it with your plugin script!! is it possible to set the list-name those emails should belong to?

@PetePot You need to specify the id of the list in the command. That is explained in the documentation page.

sorry but I do not see the script, am I missing something. Thanks

I was able to make it work.

1 Like

How did you get it to work please?

Were you using the built-in CLI importer, or did you end up having to use the plugin?

If you were using the built-in importer, can you give me an example. I keep getting the same security token warning you described when I try.