I would like a PHP script that logs into a gmail account and then scans whether an unread email with a specified subject exists. If so, it calls an outside script (such a script that would log it) and then deletes the email. It would all run on cron. Anyone know where I can start? Or where I can find a script if one already exists?
This looks like roughly the same question, and it has an answer: http://stackoverflow.com/questions/2485257/how-to-make-a-php-script-that-read-an-email-from-the-server
cURL is awesome, but you should avoid it if there's a way to do this using standard protocols. You can use PHP to connect to Google via IMAP. I wrote this like 6 years ago, and it's not perfect, but it should get you started: https://forums.digitalpoint.com/threads/php-site-that-shows-all-emails-sent-to-domain.366470/