-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create script for fetching disposable email providers
- Loading branch information
1 parent
67848ff
commit c9e8a34
Showing
3 changed files
with
5,368 additions
and
4,737 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env php | ||
|
||
<?php | ||
|
||
/* | ||
* To update disposable email providers from the command line run: | ||
* $ ./update-disposable-email-providers.php | ||
*/ | ||
|
||
$disposableEmailProvidersLocation = 'https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json'; | ||
|
||
$disposableEmailProvidersJson = file_get_contents($disposableEmailProvidersLocation); | ||
|
||
if (!is_string($disposableEmailProvidersJson)) { die('Failed to fetch providers'); } | ||
|
||
$disposableEmailProviders = json_decode($disposableEmailProvidersJson, true); | ||
|
||
if (!is_array($disposableEmailProviders)) { die('Unable to decode JSON'); } | ||
|
||
$exportedArray = var_export($disposableEmailProviders, true); | ||
|
||
$phpFileTemplate = <<<TEMPLATE | ||
<?php | ||
/** | ||
* This data is autogenerated. | ||
* | ||
* @see https://github.com/ivolo/disposable-email-domains | ||
*/ | ||
return {$exportedArray}; | ||
TEMPLATE; | ||
|
||
$writeToFile = file_put_contents('../src/data/disposable-email-providers.php', $phpFileTemplate); | ||
|
||
if (!$writeToFile) { die('Failed to write to file'); } | ||
|
||
echo "Successfully Fetched Disposable Email Providers"; | ||
exit(); |
Oops, something went wrong.