Integrate the Parked Domain API in PHP
A signup, ad-placement audit, or filtering rule may need to distinguish an active website from a parked domain. By the end of this guide, you can send a domain to Klazify from PHP, inspect its classification, and route uncertain results for review—without treating a missing category as proof that a domain is parked.
Why use classification in a parked-domain workflow?
Parked domains can be difficult to assess from their names alone. A domain may be new, temporarily unreachable, or serving content that does not clearly describe an operating business. Documentation describes the categorization API used to gather context for these decisions.
Klazify analyzes website content rather than relying only on domain names or metadata. Its hierarchical categories and IAB mappings can help distinguish a site with identifiable content from one that needs further investigation. The API also supports analysis across languages, which is useful when reviewing domains from international signups or ad inventory.
The important boundary is that the response shown here does not contain a parked-domain flag. Categories, company details, and registration information are signals for a review workflow; none of them alone establishes whether a domain is parked. Compared with a rule based only on a domain name or an old local list, a classification request gives your application more context to inspect, but it is not a substitute for a dedicated verification step.
For example, an ad platform can classify an inventory domain, map a returned category to its placement policy, and send an unclassified result for review. A CRM pipeline can instead attach available company data to a signup while keeping the parked-domain status unresolved. A network filter can apply its own category rules without equating every unknown result with a parked site.
Send a categorization request
Klazify uses a JSON POST request with a Bearer token. Create an account and obtain an API key, then replace YOUR_API_KEY in the request below. The Starter plan is $39.99 per month with a 7-day trial; failed or unreachable calls are not billed.
curl --request POST 'https://www.klazify.com/api/categorize' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"url":"https://cbsnews.com"}'
Keep the key on the server, not in browser JavaScript or a public repository. The request accepts the URL in the JSON body. Retain the submitted URL alongside your internal job identifier so you can associate the result with the signup, placement, or filtering event that prompted it.
Call the API from PHP
This example uses PHP’s cURL extension. Set KLAZIFY_API_KEY in the environment and pass the URL to classify as the script’s first argument. It prints the category names and confidence values when available; it does not make a parked-domain decision.
<?php
$apiKey = getenv('KLAZIFY_API_KEY');
$url = $argv[1] ?? '';
if (!$apiKey || $url === '') {
fwrite(STDERR, "Set KLAZIFY_API_KEY and pass a URL as an argument.\n");
exit(1);
}
$handle = curl_init('https://www.klazify.com/api/categorize');
curl_setopt_array($handle, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(
['url' => $url],
JSON_THROW_ON_ERROR
),
]);
$body = curl_exec($handle);
if ($body === false) {
fwrite(STDERR, "Request failed: " . curl_error($handle) . "\n");
curl_close($handle);
exit(1);
}
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status < 200 || $status >= 300) {
fwrite(STDERR, "API returned HTTP status " . $status . "\n");
exit(1);
}
try {
$result = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $exception) {
fwrite(STDERR, "Could not decode the response as JSON.\n");
exit(1);
}
if (($result['success'] ?? false) !== true) {
fwrite(STDERR, "Classification did not report success.\n");
exit(1);
}
$categories = $result['domain']['categories'] ?? [];
if (!is_array($categories) || count($categories) === 0) {
echo "No categories available; review the domain.\n";
exit;
}
foreach ($categories as $category) {
$name = $category['name'] ?? 'Unnamed category';
$confidence = $category['confidence'] ?? 'not provided';
echo $name . ' — confidence: ' . $confidence . "\n";
}
Use the output as input to your own policy rather than as the policy itself. For production, record transport errors, non-successful responses, and successful responses with no usable category separately. Those outcomes need different follow-up, even if all initially enter a review queue.
Call the same endpoint from Python
If classification runs in a Python worker instead, the standard library can make the same request. This version also takes the URL as an argument and reads the API key from the environment.
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
api_key = os.environ.get("KLAZIFY_API_KEY")
if not api_key or len(sys.argv) < 2:
sys.exit("Set KLAZIFY_API_KEY and pass a URL as an argument.")
payload = json.dumps({"url": sys.argv[1]}).encode("utf-8")
request = Request(
"https://www.klazify.com/api/categorize",
data=payload,
headers={
"Authorization": "Bearer " + api_key,
"Content-Type": "application/json",
},
method="POST",
)
try:
with urlopen(request) as response:
result = json.load(response)
except (HTTPError, URLError, ValueError) as error:
sys.exit("Request or response failed: " + str(error))
if result.get("success") is not True:
sys.exit("Classification did not report success.")
categories = (result.get("domain") or {}).get("categories") or []
if not categories:
print("No categories available; review the domain.")
else:
for category in categories:
print(
category.get("name", "Unnamed category"),
category.get("confidence", "not provided"),
)
Interpret the response without assuming a parked status
The following is the documented example response. It illustrates the fields and values your parser can encounter; it is not presented as the response to the curl request above.
{
"domain": {
"categories": [
{
"confidence": 0.92,
"name": "/Computers & Electronics/Consumer Electronics",
"IAB-632-596": "Consumer Electronics/Technology & Computing/Consumer Electronics"
},
{
"confidence": 0.89,
"name": "/Internet & Telecom/Mobile & Wireless/Mobile Phones"
}
],
"social_media": null,
"logo_url": "https://klazify.s3.amazonaws.com/2110787991611585019600ed5fb1d1300.04730104.png"
},
"success": true,
"objects": {
"company": {
"url": "https://www.apple.com/",
"name": "Apple",
"city": "Cupertino",
"stateCode": "CA",
"countryCode": "US",
"employeesRange": "100K+",
"revenue": 274515000000,
"raised": null,
"tags": [
"E-commerce",
"Consumer Electronics",
"Mobile",
"B2C"
],
"tech": [
"omniture_adobe_analytics",
"atlassian_confluence",
"successfactors",
"apache_apex",
"talend",
"oracle_peoplesoft",
"salesforce",
"stripe",
"dell_boomi_atomsphere",
"gigya",
"sage_50cloud",
"quickbooks",
"webmethods",
"apache_tomcat",
"alteryx",
"tibco_rendezvous",
"atlassian_jira",
"..."
]
}
},
"domain_registration_data": {
"domain_age_date": "1987-02-19",
"domain_age_days_ago": "13026",
"domain_expiration_date": "2030-02-20",
"domain_expiration_days_left": "123"
},
"similar_domains": [
"bestbuy.com",
"icloud.com",
"microsoft.com",
"macrumors.com",
"google.com",
"samsung.com",
"twitter.com",
"hp.com",
"bhphotovideo.com",
"dell.com"
]
}
Check success before using the data, then iterate over domain.categories. Each category has a name and may include a confidence value or an IAB mapping such as IAB-632-596. The second category in this example has no IAB field, so your parser should not require one on every entry.
For enrichment, objects.company contains fields such as name, location, employee range, tags, and technology identifiers in this example. The response also includes social_media, logo_url, registration data, and similar domains. Treat nullable or absent values as unavailable, not as a definitive statement about the site.
The registration date fields are date strings, while the day-count fields shown are strings containing day counts. Preserve the raw values if you need an audit trail, and parse them explicitly before numerical comparisons. The sample does not establish that a particular domain age or expiration interval means a site is parked.
Likewise, a confidence value concerns the returned classification; it is not a parked-domain probability. Choose any confidence threshold as an internal policy, test it against reviewed cases, and route borderline results for review. Do not infer that a domain is active solely because it has a category, or parked solely because company data is missing.
Turn signals into an operational decision
Start by defining the outcome your application needs. A signup enrichment job may tolerate an unresolved domain while retaining the lead. An ad-placement audit may hold a placement for review, while a filtering system may follow a separate fallback policy when classification is unavailable.
Keep the API result separate from your decision. Store the raw category names and confidence values alongside your internal label, the policy version, and the time your application received the result. This lets a reviewer understand whether a decision came from a returned category, an internal rule, or a manual check.
Map categories to your taxonomy
Build a mapping from the category names or available IAB values to labels your application already uses. For instance, a category in the response might map to an internal audience segment for enrichment or to an ad-placement review rule. A category that has no mapping should remain unmapped rather than being silently assigned to an unrelated bucket.
Allow multiple mappings when a domain returns multiple categories. Decide explicitly whether any matching category triggers review, whether the highest-confidence category takes precedence, or whether a human should resolve conflicting signals. Keep the original values so you can revise mappings without losing what the API returned.
For parked-domain handling, maintain a separate internal status such as “needs review” until your verification process reaches a conclusion. The example response does not define a category or field that confirms parking, so a category mapping alone should not produce that conclusion.
Cache, queue, and retry deliberately
Cache results per normalized domain when your policy is domain-level. Normalize consistently—for example, apply the same casing and hostname treatment before lookup—while retaining the originally submitted URL for traceability. If your workflow classifies individual pages, avoid reusing a domain-level cache entry as though it necessarily describes every page.
Choose a configurable cache lifetime based on how quickly your decisions need to reflect changes. Refresh stale entries asynchronously where possible, and avoid repeatedly requesting the same domain when a valid cached result is available. Newly registered or recently changed domains may warrant a different refresh policy from established entries, but registration age alone is not a parking determination.
For large inputs, deduplicate domains before submitting work and process requests through a queue with controlled concurrency. Check the current account limits before selecting worker throughput; do not assume a particular batch size or rate limit. If a request is throttled or temporarily fails, use bounded retries with backoff and retain the job for later inspection if retries are exhausted.
Track unreachable requests, unsuccessful API responses, empty categories, and unmapped categories separately. A temporary failure is not an unknown classification, and an unknown classification is not a parked-domain finding. Failed or unreachable calls are not billed, but they still require operational monitoring so that a pipeline does not quietly accumulate unresolved domains.
For tools that use an MCP workflow, see MCP. Keep the same distinction between returned classification data and your own parked-domain decision regardless of how the result enters the pipeline.
FAQ
Is there a separate parked-domain endpoint?
The integration shown uses the categorization endpoint. The example response does not provide a parked flag, so use its fields as context and apply a separate verification process before labeling a domain parked.
Does an empty category list mean the domain is parked?
No. An empty or unavailable classification should be treated as unresolved. Retry when appropriate or send it to review rather than automatically blocking it as parked.
Should I cache by URL or domain?
Cache by normalized domain for domain-level decisions. If you classify specific pages, preserve URL-level distinctions so that one page’s category is not automatically applied to another.
What should I do with an unfamiliar category?
Store the original category and mark it as unmapped. Add a mapping after reviewing how it fits your taxonomy; avoid forcing it into a policy bucket simply to complete the record.
Ready to add classification to your review pipeline? Register to create a free account, then use the request and PHP example above to start classifying domains.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free