How to Validate a Domain Name’s Quality Score in PHP
1 min readApr 21, 2023
Looking for an easy way to check domain quality scores? You can implement a simple, easy domain quality check using the ready-to-run PHP code examples below. Each request will return a value ranging from 0.0 (low quality) to 10.0 (high quality).
To take advantage of this API for free, we can start by installing the client SDK. Let’s run the following command:
composer require cloudmersive/cloudmersive_validate_api_client
After that, let’s use the following code to structure our API calls:
<?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\DomainApi(
new GuzzleHttp\Client(),
$config
);
$domain = "domain_example"; // string | Domain name to check, for example \"cloudmersive.com\".
try {
$result = $apiInstance->domainQualityScore($domain);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DomainApi->domainQualityScore: ', $e->getMessage(), PHP_EOL;
}
?>
We can authenticate our requests with a free-tier API key by registering a free account on the Cloudmersive website.
All done — no more code required!