I'm trying to write a PHP cron job that would call an API, return a set of numerical variables, calculate a second set of variables, and send an email to selected recipients with those variables plugged into the text.
My question: should I do this in a three-step process:
- Call API and log variables in JSON file
- Calculate new variables and write to 2nd JSON
- Send email referencing 2nd JSON variables
Or, alternatively, can the call, calculation, and email function be executed in a single job? I don't see any documentation on sending emails with dynamic variables based on an API call, so if you know of any documentation on this subject please share!