I would like to check twice daily if there is some new data published and send me an email if this is the case.
In pseudo code here what I thought I could do:
- Get new list of movies (external API request)
- Get old list of movies (stock somewhere but how?)
- Compare the two list Send email with wp_mail
- Update content of old list for the next time (how?)
- Repeat process twice daily with wp_cron
My problem is that I don’t know how and where to stock the previous list of movies?
I thought about a global variable that I could call in the function but from what i red so far, it seems that it is always better to avoid global variable? Also I don’t know if it is possible to update the global variable for the next task.
Any idea about how to manage the list or maybe a different approach?
Thank you for your help