* int $count Number of emails to remove.įunction removeEmailsFromInputFile($count) * Removes first $count emails from input file. } else mlog("loadEmailsFromInputFile(): ERROR: Unable to open file '$emailsInputFile'.") Global $emailsInputFile, $emailsPerRequest * array Array of first $emailsInputFile emails from the input file. * Loads first $emailsPerRequest lines of input file. Mlog("processIncomingData(): No incoming data. $result = removeEmailsFromInputFile($counter) Įlse mlog("processIncomingData(): ERROR: Call failed with error message: '"Įlse mlog("processIncomingData(): ERROR: Call failed. Mlog("processIncomingData(): $counter emails processed.") Mlog("processIncomingData(): Call succeeded.") Mlog("processIncomingData(): Incoming data ($jsonLen bytes) detected " $json = file_get_contents('php://input') * If not, does nothing and returns immediately. * Checks if there are any incoming data in form of JSON POST. $res = file_put_contents($emailsValidatedFile, "") Įlse mlog("initialization(): ERROR: Unable to write to log file '$logFile'.") Įlse mlog("initialization(): ERROR: Unable to write to output file "Įlse mlog("initialization(): ERROR: Unable to write to input file '$emailsInputFile'.") Įlse mlog("initialization(): ERROR: Unable to read input file '$emailsInputFile'.") $res = file_put_contents($emailsInputFile, $inputContents) $inputContents = file_get_contents($emailsInputFile) Global $emailsInputFile, $emailsValidatedFile, $logFile * bool Returns true if succeeded, false otherwise. * It verifies that we have access rights to all files that we need. * This function is called during the inital request that starts the job. $signature = hash_hmac('sha512', $message, $secret) Ĭurl_setopt($ch, CURLOPT_RETURNTRANSFER, true) Ĭurl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST") Ĭurl_setopt($ch, CURLOPT_POSTFIELDS, $postFields) Ĭurl_setopt($ch, CURLOPT_HTTPHEADER, $headers) Ĭurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE) Ĭurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE)
$time = $dateTime->format('Y-m-d H:i:s') $dateTime = new \DateTime('now', new \DateTimeZone('UTC')) $postFields = http_build_query($postData)
$success is false and $data contains error message.įunction odtSendRequest($key, $secret, $action, array $postData) In this case $data represents the returned result. * array $success is true, if the operation succeeded, * array $postData ODT API action data - see ODT API documentation. * string $action ODT API action - see ODT API documentation. The script loads emails from the database and processes them in as many batches as needed, while respecting the limitations of ODT API.
Any PHP 5.3+ hosting should be able to run this script. It uses asynchronous callback method in order to minimize needs for settings of the environment where the script can be successfully run.
EMAIL VERIFIER API HOW TO
The code sample below demonstrates how to use Online Domain Tools Email Verifier API.