How to Get the Industry Tags in PHP
Your team needs to capture reliable “industry tags” for every domain that hits your stack, so you can block or allow traffic by category, enrich new signups in your CRM, and audit where ads run. In this guide, you’ll implement a working flow to fetch industry tags (and related company data) from a domain using Klazify, wire it into a PHP backend, and make it production-ready with caching, batching, and error handling.
Why Klazify for extracting industry tags from domains in PHP
When your PHP services need fast, accurate industry signals for domains, Klazify focuses on the parts that matter:
- Accurate Website Categorization Using AI: The API analyzes full site content, not just metadata, so industry tags reflect the site’s actual topics and business focus. This matters when you’re deciding to block ad placements or label a new lead.
- Global Coverage: Works across multiple languages, useful when your traffic and signups span regions and you still need consistent tags in your pipeline.
- Real-Time Classification: Fresh analysis prevents decisions based on stale categories—important for brand safety and risk scoring.
- Industry-Level Categories: Maps to IAB taxonomy, giving you standardized, granular industry context that fits ad tech, analytics, and content filtering.
- Simple API Integration: A single REST call from PHP (or any runtime) returns tags and company attributes that slot into your enrichment tables.
- Compliance and Filtering: Useful for quickly whitelisting/blacklisting categories, enforcing corporate browsing policies, or routing traffic to the right model or feature flag.
We’ll focus on fetching tags from a domain and turning the response into actionable data structures for downstream systems running in PHP, with examples also shown in JavaScript.
What you’ll build
By the end, you will:
- Call Klazify’s company endpoint to retrieve tags and core firmographics by domain.
- Extract fields you need: name, location, employeesRange, revenue (returned as a range), raised, and tags.
- Transform tags into your own taxonomy or store as-is.
- Implement caching and batching to keep latency low and costs predictable.
Signup is quick. Starter is $39.99/mo with a 7-day trial, and failed or unreachable calls are not billed. Create your key: Register. You can also review the Documentation any time.
Endpoint you’ll use: domain_company
To get industry tags and company context from a URL or domain, use:
- Method: POST
- URL: https://www.klazify.com/api/domain_company
- Auth: Bearer token
- Body: JSON with the url field
The response includes (among others) these fields you’ll use directly in enrichment and policy logic:
- name: Company name inferred from the domain.
- city, stateCode, countryCode: Location details for geographic routing and compliance checks.
- employeesRange: Company size band, ideal for lead scoring.
- revenue: A revenue range (not an exact figure), for segmentation and prioritization.
- raised: Capital raised if known, useful in B2B matching workflows.
- tags: Industry tags extracted from the website, used for filtering, categorization, and analytics.
Copy-paste curl to fetch tags
This example shows a POST to the company endpoint using an Authorization bearer token and a JSON body containing the domain URL.
curl -X POST "https://www.klazify.com/api/domain_company" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://cbsnews.com"}'
Replace YOUR_API_KEY with your key from your Klazify account. Use a production HTTP client in your PHP app and add retries and caching as shown later.
Official JSON response example and how to read it
Below is the official example response format you should know how to parse. It includes domain categorization, company data, domain registration data, and similar domains. You’ll map these structures to your own classes or tables, then specifically extract the company tags and other business attributes.
{
"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"
]
}
How to use these fields:
- domain.categories: Useful for content filtering and brand safety policies. Each item has a confidence and an IAB mapping when available.
- domain.logo_url: Store for UI enrichment or CRM profiles.
- objects.company.tags: These are the “industry tags” you’ll index for allow/deny lists, audience segmentation, or signup enrichment.
- objects.company.name, city, stateCode, countryCode, employeesRange, revenue, raised: Core firmographics for lead scoring and routing. Note: when requesting via the domain_company endpoint, revenue is returned as a range rather than an exact figure.
- domain_registration_data: Helpful for risk scoring (e.g., very new domains).
- similar_domains: Can power “related accounts” or lead discovery features.
PHP integration: extract and act on tags
Use PHP’s cURL and JSON extensions to call Klazify and parse tags. You’ll post a URL and then read the company object. Keep a domain-level cache to avoid repeated calls on the same site in a short period.
<?php
$apiKey = 'YOUR_API_KEY';
$payload = json_encode(['url' => 'https://cbsnews.com']);
$ch = curl_init('https://www.klazify.com/api/domain_company');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode >= 200 && $httpCode < 300 && $response) {
$data = json_decode($response, true);
// defensive parsing
$company = $data['objects']['company'] ?? null;
if ($company) {
$name = $company['name'] ?? null;
$tags = $company['tags'] ?? [];
$employeesRange = $company['employeesRange'] ?? null;
$revenueRange = $company['revenue'] ?? null; // range value when using domain_company
$location = [
'city' => $company['city'] ?? null,
'stateCode' => $company['stateCode'] ?? null,
'countryCode' => $company['countryCode'] ?? null
];
// Example: enforce a block policy on certain tags
$blockedTags = ['Gambling', 'Adult', 'Malware']; // your own policy list
$isBlocked = count(array_intersect($blockedTags, $tags)) > 0;
// Persist to DB with your schema
// saveCompanyEnrichment($domain, $name, $tags, $employeesRange, $revenueRange, $location);
if ($isBlocked) {
// route or deny based on policy
// denyRequest($domain);
}
}
} else {
// Unreachable or failed calls are not billed; apply a safe default
// fallbackPolicy($domain);
}
?>
This snippet shows how to read the tags array, join it to your block/allow lists, and store firmographics for later analytics. Add your database persistence and structured logging around it.
JavaScript example for workers, lambdas, or queues
If part of your pipeline runs in Node.js (e.g., a job consumer enriching queued domains), here’s a minimal example calling the same endpoint:
import fetch from "node-fetch";
const API_KEY = process.env.KLAZIFY_API_KEY;
const urlToClassify = "https://cbsnews.com";
async function getCompanyTags(url) {
const res = await fetch("https://www.klazify.com/api/domain_company", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ url })
});
if (!res.ok) {
// not billed if unreachable; apply fallback
return { tags: [], blocked: false, reason: "unreachable" };
}
const data = await res.json();
const company = data?.objects?.company ?? {};
const tags = company.tags ?? [];
// Sample enforcement logic
const blockedTags = new Set(["Gambling", "Adult", "Malware"]);
const blocked = tags.some(t => blockedTags.has(t));
return {
name: company.name ?? null,
tags,
employeesRange: company.employeesRange ?? null,
revenueRange: company.revenue ?? null, // range when using domain_company
location: {
city: company.city ?? null,
stateCode: company.stateCode ?? null,
countryCode: company.countryCode ?? null
},
blocked
};
}
getCompanyTags(urlToClassify).then(console.log).catch(console.error);
This function returns the essential fields you’ll likely write to your enrichment table and an immediate blocked flag you can use at decision time.
Mapping Klazify categories and tags to your taxonomy
You’ll often need to align Klazify’s tags and IAB categories with your internal labels. A straightforward pattern:
- Create a mapping table with two columns: klazify_value and internal_label.
- When you ingest a domain, upsert any new tags or category names you haven’t seen before as “unmapped”.
- Periodically review unmapped values and assign them to internal categories; keep the mapping under version control.
- At runtime, translate incoming tags via that table to power your feature flags, ad rules, or risk scoring.
Note that the API can include IAB mappings under domain.categories, which many ad tech pipelines already use. If you rely primarily on industry tags (objects.company.tags), treat them as label features and map them like any other categorical attribute.
Operational details: batching, caching, and unknown domains
- Batching: If you have a queue of domains, process them in controlled batches to avoid burst traffic. Space requests and use a job system to retry transient failures.
- Caching per domain: Cache results at the domain level in your DB or a TTL cache. A 24–72 hour TTL is common for enrichment data; adjust based on how often you need updated info.
- Handling unknown or new domains: If a newly seen domain returns sparse data, store what’s available and re-enqueue for a later refresh. Consider a “pending classification” state for your UI.
- Timeouts and retries: Keep HTTP timeouts modest and implement 1–2 retries with exponential backoff.
- Rate limits: Follow best practices to keep steady request rates. If you expect spikes, buffer through a queue. For plan-specific constraints, see the Documentation.
- Cost control: Cache aggressively and deduplicate domains at the edge. Failed or unreachable calls are not billed.
How to use the returned fields in your pipeline
- Block/Allow policies: Use objects.company.tags and domain.categories to check against policy lists before serving ads, content, or links. For example, disallow “Gambling” or “Adult” tags.
- CRM enrichment: When a user signs up with a domain (e.g., email domain), fill company name, employeesRange, revenue range, raised, and tags. This supports lead scoring and assignment.
- Analytics: Use tags as dimensions for traffic analysis, ad performance, and cohort studies.
- UI enrichment: Show logo_url alongside company name (from domain.logo_url) to improve operator and sales tooling.
- Risk scoring: Combine domain_age_days_ago and categories to detect newly registered or sensitive domains.
Field quick reference
| Field | Where | Usage |
|---|---|---|
| objects.company.tags | Company object | Primary “industry tags” for filtering, scoring, and policies. |
| objects.company.employeesRange | Company object | Lead scoring, routing, and segmentation. |
| objects.company.revenue | Company object | Revenue range for B2B prioritization; store as a categorical/range value. |
| objects.company.city/stateCode/countryCode | Company object | Geo-based routing, compliance, territory assignments. |
| domain.categories | Domain object | Content categories (with IAB mapping where available) for brand safety and classification. |
| domain.logo_url | Domain object | UI enrichment (dashboards, CRM profile cards). |
| domain_registration_data | Top-level | Risk scoring based on domain age and expiration. |
| similar_domains | Top-level | Discover related sites for research or expansion. |
Pipeline design: when and where to call Klazify
- Synchronously at signup: If you need immediate tags for a decision (e.g., block certain industries), call the API directly in the request path with a tight timeout and a safe default.
- Asynchronously via a worker: For bulk enrichment, publish domains to a queue and process them in a background job. Store results in your enrichment table keyed by domain.
- Periodic refresh: Schedule a job that rechecks domains after the TTL expires, updating tags and company fields.
- Edge caching: If you classify URLs coming through gateways, normalize to the registrable domain and cache results to reduce duplicate work.
Testing and observability
- Contract tests: Validate that required fields (e.g., objects.company.tags) are present before writing to downstream stores.
- Metrics: Track hit rate, cache ratio, median/95p latency, success ratio, and the distribution of tags encountered.
- Alerting: Page on sustained error spikes or unexpected empty responses if that would affect policy enforcement.
- Sampling: Retain a small sample of raw responses for debugging and for updating your taxonomy mappings.
Pricing, signup, and where to learn more
Starter is $39.99/mo with a 7-day trial, and unreachable calls aren’t billed. Create your key in minutes: Register. Read endpoint details and examples in the Documentation. For managed components and integration patterns, check the MCP. Visit the homepage for product overview: Klazify.
FAQ
Do I need the full URL or just the domain?
Send either; using the registrable domain is typical for enrichment. The body should include a single "url" field.
What if a domain doesn’t return tags yet?
Store a placeholder, mark the record as “pending,” and retry later. Keep your application logic resilient with safe defaults.
How should I store revenue and employee size?
Store revenue as a range (categorical) and employeesRange as provided. Use them in scoring rules rather than assuming precise numeric values.
Can I rely on one call per domain forever?
Cache results with a TTL and re-fetch periodically. Websites evolve, so a scheduled refresh helps keep your policies accurate.
How do I align Klazify tags with my internal categories?
Maintain a mapping table and auto-capture new, unmapped tags during ingestion. Review and assign them to your internal taxonomy regularly.
Get your API key and start enriching domains with industry tags in minutes. Sign up now: Register.
Ready to use Klazify?
Start classifying websites, enriching company data, and exploring web intelligence.
Get Started Free