Created
April 25, 2019 18:12
-
-
Save nellytadi/8f6f2403b06d49308547d29e0c0c23a6 to your computer and use it in GitHub Desktop.
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 | |
$email='john@example.com'; | |
public function validate($email) | |
{ | |
// Initialize CURL: | |
$ch = curl_init('http://apilayer.net/api/check?access_key='.$access_key.'&email='.$email.''); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
// Store the data: | |
$json = curl_exec($ch); | |
curl_close($ch); | |
// Decode JSON response: | |
$validationResult = json_decode($json, true); | |
checkfunction($validationResult['format_valid']); | |
} | |
//function to check validation function | |
public function checkfunction($email){ | |
if ($email==false) { | |
die('Wrong email'); | |
} | |
else{ | |
echo 'Valid email'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment