Created
August 24, 2023 09:04
-
-
Save mpdroog/c056ca485dd98c6fc9ad7ac2ef2fdca2 to your computer and use it in GitHub Desktop.
debounce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
?php | |
/** | |
* import debounce CSV | |
*/ | |
require __DIR__ . '/../vendor/autoload.php'; | |
core\Unsafe::init(); | |
require_once __DIR__ . '/../vendor/mpdroog/core/init-cli.php'; | |
use core\Cli; | |
use core\Helper; | |
use prj\Shared; | |
use lib\smtpw\Email; | |
$handle = fopen(__DIR__ . "/debounce.csv", "r"); | |
if ($handle === FALSE) { | |
user_error("fopen: fail"); | |
} | |
while (($tok = fgetcsv($handle, 1000, ",")) !== FALSE) { | |
// EMAIL,RESULT,REASON,"STATUS CODE",ROLE,FREE,DOMAIN | |
// a.grutterink@home.nl,"Safe to Send",Deliverable,5,No,Yes,home.nl | |
if ($tok[1] === 'Safe to Send') continue; | |
if ($tok[1] === 'Deliverable') continue; | |
if ($tok[0] === "NO_EMAIL") continue; | |
if ($tok[0] === "") die("FAIL"); | |
$h = hash("sha256", $tok[0]); | |
Shared::db()->insertIgnore("_debounce", [ | |
"email_hash" => $h, | |
//"email" => $tok[0], | |
"result" => $tok[1], | |
"reason" => $tok[2], | |
"code" => str_replace(",", ".", $tok[3]), | |
"role" => $tok[4], | |
"free" => $tok[5], | |
"domain" => $tok[6] | |
], false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment