I've got an app based on phantomjs that works so: 1. I'm running a php script that gets data from my databse (postgres) as an array, 2. Then via shell_exec I'm running phantomjs script and as argument I'm passing array with data (1), 3. In phantom I'm processing the data - checking domains WHOIS - and collecting for each domain expiration date. As result I'm getting an array that I'm storing in a file, 4. In the end phantom runs php script that gets the data from stored file and saves it in my database.
I'm wondering if there is a better option? Maybe doing everything in the phantomjs script? Maybe there is a js client for postgres?