Thanks to an abundance of phishing data, deep learning AI phishing detection has come a long way. What better way to detect phishing attacks than with a well-trained anti-phishing model?
Using the below code, you can take advantage of an AI phishing detection API for your PHP applications. This accepts email file inputs (EML, MSG, etc.) as well as emails converted to different formats (PDF, DOCX, PNG, JPG, etc) and additionally scans attached files/content for embedded phishing attempts.
Implementing this API is super easy. First, you can run the following command to install the SDK:
composer require cloudmersive/cloudmersive_phishing_api_clientAnd after that you can use the below code examples to structure your API request:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');
$apiInstance = new Swagger\Client\Api\PhishingDetectionApi(
new GuzzleHttp\Client(),
$config
);
$body = new \Swagger\Client\Model\AdvancedEmailDetectionRequest(); // \Swagger\Client\Model\AdvancedEmailDetectionRequest | Phishing detection request
try {
$result = $apiInstance->phishingDetectEmailAdvancedPost($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PhishingDetectionApi->phishingDetectEmailAdvancedPost: ', $e->getMessage(), PHP_EOL;
}
?>Your request body should follow the below model:
{
"FromEmailAddress": "string",
"ToEmailAddress": "string",
"Subject": "string",
"HtmlBody": "string",
"AllowLowReputationSenders": true,
"AllowSanctioned": true,
"CustomPolicyID": "string",
"InputEmailFile": "string"
}And your API response will follow the below response model:
{
"CleanResult": true,
"PhishingRiskLevel": 0,
"SpamRiskLevel": 0,
"ContainsLowReputationSender": true,
"ContainsPhishing": true,
"ContainsSpam": true,
"ContainsUnsolicitedSales": true,
"ContainsPromotionalContent": true,
"ContainsPhishingAttempt": true,
"AnalysisRationale": "string"
}That's all there is to it: you can now employ powerful AI phishing detection against inbound emails, files, and the HTML wrapping they hold.