To verify an email using PHP, you can use the following code:
“`php
function verifyEmail($email) {
// Initialize curl
$ch = curl_init();
// Set the API endpoint URL
$url = ‘https://api.email-validator.net/api/verify’;
// Set the parameters
$params = array(
‘EmailAddress’ => $email,
‘APIKey’ => ‘YOUR_API_KEY’
);
// Set curl options
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
CURLOPT_RETURNTRANSFER => true
));
// Execute the curl request
$response = curl_exec($ch);
// Check for curl errors
if(curl_error($ch)) {
echo ‘Curl error: ‘ . curl_error($ch);
return false;
}
// Close curl
curl_close($ch);
// Parse the response JSON
$result = json_decode($response, true);
// Check the verification result
if(isset($result[‘status’]) && $result[‘status’] === ‘valid’) {
return true;
} else {
return false;
}
}
// Usage example
$email = ‘example@example.com’;
if(verifyEmail($email)) {
echo ‘Email is valid’;
} else {
echo ‘Email is not valid’;
}
“`
Make sure to replace `’YOUR_API_KEY’` with your actual API key from Email Validator API.