How to Get a Company Name in PHP

October 24, 2026
How to Get a Company Name in PHP

You have a form signup or a stream of new domains, and your PHP app needs to resolve each domain to the company’s legal name and basic firmographics in milliseconds. By the end of this guide, you’ll plug Klazify’s API into a PHP workflow to get a company name (and related fields like location, employeesRange, revenue range, raised, and tags) from a URL or domain, and ship it to your CRM, data lake, or ad tech filters with caching and retries in place.

Why Klazify for extracting company names from domains

When your pipeline depends on accurate company identification for lead enrichment, signup validation, or domain auditing, false positives add downstream noise. Klazify’s domain intelligence API focuses on extracting company information directly from a URL, and it supports:

Illustration: How to Get a Company Name in PHP
  • Accurate website categorization using AI: The same content understanding that powers IAB mapping also improves company identification, reducing ambiguity across domains that host mixed or syndicated content.
  • Global coverage: Resolve names and locations for international domains across multiple languages, which is essential for global signups and CRM enrichment flows.
  • Real-time classification: Request-time analysis makes your enrichment reflect the live website instead of relying on stale snapshots.
  • Industry-level categories with IAB taxonomy: When needed, enrich the company record with consistent IAB-aligned categories for brand safety, content filtering, or audience modeling.
  • Simple API integration: A REST interface with Bearer auth, JSON requests, and developer-focused response fields fits cleanly into PHP backends, serverless functions, or any ETL job.
  • Superior compliance and filtering: Cleanly separate personal project sites, affiliate pages, and corporate entities to support automated allowlists, ad placement checks, or signup risk scoring.

Get started with a free account and 7-day trial on the Starter plan ($39.99/mo). Failed or unreachable calls are not billed, so you can implement resilient retry logic without worrying about surprise charges.

Learn more on the homepage: www.klazify.com.

The core scenario: enrich a signup with the company name in PHP

Suppose your app receives a domain at account creation time (e.g., from an email domain or a website field). You want to append the company’s official name and city/country. Klazify exposes a company data endpoint where you post the URL or domain and receive standardized fields including name, city, stateCode, countryCode, employeesRange, revenue, raised, and tags.

At a high level you will:

  • POST the user-provided URL to the company endpoint.
  • Parse the JSON response for objects.company.name and related fields.
  • Cache by eTLD+1 (e.g., example.co.uk) to minimize repeat lookups.
  • Fallback gracefully if the domain is unknown or unreachable.

While this guide demonstrates PHP and one JavaScript snippet, the approach is identical in Python, Go, or Java with a standard HTTP client.

Endpoint and request format

Use the company lookup endpoint to fetch the company name and related information from a domain:

  • Method: POST
  • URL: https://www.klazify.com/api/domain_company
  • Auth: Bearer token in Authorization header
  • Body: JSON with a url field

curl request (copy/paste)

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 token. You can create a free account here: Register.

Official JSON response example and how to use it

Below is the official example response format. Do not rely on any values outside this example when building your parser; use the fields and structure as your guide.


{
    "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"
    ]
}

Key fields you will typically use:

  • objects.company.name: the company’s official name. Store this in your CRM or use it to prefill signup forms.
  • objects.company.city, stateCode, countryCode: basic location fields for routing and territory assignment.
  • objects.company.employeesRange: size band for lead scoring or routing rules.
  • objects.company.revenue: revenue metric you may normalize into your own bands.
  • objects.company.raised: funding data if available.
  • objects.company.tags: business tags for segmentation and targeting.
  • domain.categories and IAB mapping: useful when you also need contextual classification or brand safety rules.

You can find full parameter and response coverage in the Documentation.

PHP implementation: get the company name safely

This PHP example posts a user-supplied domain to Klazify, extracts the company name and location, and demonstrates caching by eTLD+1. You can adapt it to frameworks like Laravel or Slim.

<?php
function etld_plus_one($host) {
    // Minimal eTLD+1 extraction for caching; consider using a PSL library in production.
    $parts = explode('.', strtolower(parse_url($host, PHP_URL_HOST) ?: $host));
    if (count($parts) < 2) return $host;
    $lastTwo = array_slice($parts, -2);
    return implode('.', $lastTwo);
}

function klazify_company_lookup($url, $apiKey) {
    $endpoint = 'https://www.klazify.com/api/domain_company';

    $ch = curl_init($endpoint);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json'
    ]);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['url' => $url]));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $resp = curl_exec($ch);
    $http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $err  = curl_error($ch);
    curl_close($ch);

    if ($err) {
        throw new Exception("HTTP error: $err");
    }
    if ($http < 200 || $http >= 300) {
        throw new Exception("Unexpected status: $http, body: $resp");
    }
    return json_decode($resp, true);
}

// Simple file cache per eTLD+1 (swap with Redis/Memcached in production)
function cached_company_lookup($url, $apiKey, $ttlSeconds = 86400) {
    $cacheDir = sys_get_temp_dir() . '/klz_cache';
    if (!is_dir($cacheDir)) mkdir($cacheDir, 0777, true);

    $key = etld_plus_one($url);
    $cacheFile = $cacheDir . '/' . preg_replace('/[^a-z0-9.]+/', '_', $key) . '.json';

    if (file_exists($cacheFile) && (time() - filemtime($cacheFile)) < $ttlSeconds) {
        $data = json_decode(file_get_contents($cacheFile), true);
    } else {
        $data = klazify_company_lookup($url, $apiKey);
        file_put_contents($cacheFile, json_encode($data));
    }

    $company = $data['objects']['company'] ?? null;
    if (!$company) {
        // Handle unknown/new domains gracefully
        return [
            'name' => null,
            'city' => null,
            'stateCode' => null,
            'countryCode' => null,
            'employeesRange' => null,
            'revenue' => null,
            'raised' => null,
            'tags' => []
        ];
    }

    return [
        'name' => $company['name'] ?? null,
        'city' => $company['city'] ?? null,
        'stateCode' => $company['stateCode'] ?? null,
        'countryCode' => $company['countryCode'] ?? null,
        'employeesRange' => $company['employeesRange'] ?? null,
        'revenue' => $company['revenue'] ?? null,
        'raised' => $company['raised'] ?? null,
        'tags' => $company['tags'] ?? []
    ];
}

// Example usage:
$apiKey = 'YOUR_API_KEY';
$domain = 'https://cbsnews.com';

try {
    $result = cached_company_lookup($domain, $apiKey);
    // Persist to CRM or show on-screen
    echo "Company: " . ($result['name'] ?? 'N/A') . PHP_EOL;
    echo "Location: " . ($result['city'] ?? '') . ' ' . ($result['stateCode'] ?? '') . ' ' . ($result['countryCode'] ?? '') . PHP_EOL;
    echo "Employees: " . ($result['employeesRange'] ?? 'N/A') . PHP_EOL;
    echo "Revenue: " . (is_null($result['revenue']) ? 'N/A' : $result['revenue']) . PHP_EOL;
} catch (Exception $e) {
    // Not billed for failed/unreachable calls
    error_log('Klazify lookup failed: ' . $e->getMessage());
}

This code handles network errors, caches by eTLD+1, and extracts only the fields typically needed to enrich signups or route leads.

JavaScript example for serverless or Node pipelines

You can achieve the same result using fetch in Node.js or a serverless function. The example below sends the same POST and reads the same fields.

import fetch from "node-fetch";

async function getCompany(url) {
  const resp = await fetch("https://www.klazify.com/api/domain_company", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ url })
  });

  if (!resp.ok) {
    const text = await resp.text();
    throw new Error(`HTTP ${resp.status}: ${text}`);
  }

  const data = await resp.json();
  const company = data?.objects?.company ?? {};

  return {
    name: company.name ?? null,
    city: company.city ?? null,
    stateCode: company.stateCode ?? null,
    countryCode: company.countryCode ?? null,
    employeesRange: company.employeesRange ?? null,
    revenue: company.revenue ?? null,
    raised: company.raised ?? null,
    tags: company.tags ?? []
  };
}

(async () => {
  try {
    const result = await getCompany("https://cbsnews.com");
    console.log(result);
  } catch (e) {
    console.error("Lookup failed (not billed on failures):", e.message);
  }
})();

When to call company data vs. categorization

Klazify provides both company data and full categorization. Use categorization when you need IAB categories for brand safety, contextual targeting, or filtering. Use the company endpoint to enrich signups or CRM records with a company’s name and firmographics. Often, teams call both for a comprehensive profile.

Task Recommended Endpoint Fields to Use
Get the company name for a signup /api/domain_company objects.company.name, city, stateCode, countryCode
Lead scoring by size and revenue /api/domain_company objects.company.employeesRange, revenue, raised, tags
Brand safety and content filtering /api/categorize domain.categories, IAB mapping, logo_url
Domain intelligence and related sites /api/categorize domain_registration_data, similar_domains

Official example responses (for testing your parser)

Use these official JSON examples to validate your integration and JSON parsing. They illustrate the structure you’ll work with, including the company object, domain categories, and domain registration data.

Official example 1


{
    "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"
    ]
}

Official example 2


{
    "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"
    ]
}

Official example 3


{
    "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"
    ]
}

Operational details you’ll want in production

Caching strategy

  • Cache results per eTLD+1 (e.g., acme.co.uk) to avoid repeat lookups across subdomains like app.acme.co.uk or blog.acme.co.uk.
  • Expiration: 24 hours is typical for enrichment; you can refresh on write for high-traffic domains.
  • Warm caches for bulk imports or data migrations by batching lookups and writing results once.

Retries, timeouts, and billing

  • Set timeouts (e.g., 10 seconds) and use exponential backoff with jitter on non-2xx responses or transient network errors.
  • Failed or unreachable calls are not billed, so instituting retries is safe.
  • Handle HTTP status codes and parseable error bodies; log both for observability.

Batching and throughput

  • Batch domains at your queue/worker level when doing large backfills. Keep each POST to a single domain URL for simplicity unless the docs state a bulk payload option.
  • Pipeline integration: Use job queues (e.g., Redis, SQS) with concurrency controls to respect rate limits. Refer to the Documentation for guidance.

Unknown or new domains

  • If objects.company is missing or incomplete, set a “pending_enrichment” flag and queue for retry after a backoff window.
  • Do not block user signup solely on enrichment availability. Instead, enrich asynchronously and patch the record.
  • Populate null-safe defaults for optional fields (e.g., tags: []).

Mapping to your own taxonomy

  • Employees, revenue, and raised: Map the returned values into your internal segments (e.g., SMB/Mid/Enterprise). Keep a deterministic, versioned mapping to avoid inconsistent scoring.
  • IAB categories: Use domain.categories and IAB codes to anchor your internal content classification. Maintain a lookup table that maps each IAB leaf to your internal content labels.
  • Tags: Treat tags as soft signals for ML features or light routing rules rather than hard constraints.

Data governance

  • Track the source field “objects.company.url” wherever you display the company name.
  • Store timestamped snapshots of the raw JSON for auditability in ETL processes.
  • Normalize countryCode and stateCode to your internal region tables to avoid duplicates.

Using categorization to complement company name extraction

Many teams pair the company name with content categories to apply brand safety rules or to segment leads by vertical. The categorization endpoint provides IAB-aligned categories and logo extraction. Your enrichment flow can call the categorization endpoint when you need content context for ad placement, filtering, or vertical assignment.

Official categorization example to test your parser


{
    "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"
    ]
}

Parse domain.categories to build allow/deny rules, and use logo_url to enhance dashboards where you display the enriched company record. For ad tech or filtering, rely on the category name and IAB mapping fields provided in the response.

Putting it all together in your pipeline

  • Trigger: New signup arrives with an email domain (e.g., example.com) or website URL.
  • Enrichment worker: Calls POST /api/domain_company with the URL. If needed, also calls /api/categorize.
  • Storage: Writes objects.company.* fields into your CRM or user profile store. Persists domain.categories and logo_url for analytics or UI.
  • Caching: Uses eTLD+1 as the cache key for 24 hours to clamp costs and reduce latency.
  • Observability: Logs latency, HTTP status, retry counts, and whether the call was skipped due to cache hit.
  • Billing safety: Retries transient failures; rest easy because failed or unreachable calls are not billed.

To learn more about schema nuances and best-practice integration patterns, see the MCP and the main site at Klazify.

FAQ

Does Klazify return a company name for any domain?
It returns company data when it can resolve the domain to a company. For unknown, new, or ambiguous domains, some fields may be missing. Handle nulls and retry later.

How should I cache results?
Cache by eTLD+1 for at least 24 hours. For busy domains, refresh asynchronously. Store the raw JSON with a timestamp for auditing.

What about rate limits and batching?
Use a worker queue with concurrency controls and backoff. For backfills, batch work at the queue level while keeping one domain per POST. Consult the Documentation for guidance.

Are failed calls billed?
No. Failed or unreachable calls are not billed, so retries and timeouts are safe to implement.

Can I also get IAB categories?
Yes. Use the categorization endpoint to complement company data with IAB-aligned categories and brand safety signals.

Ready to enrich your signups and CRM with accurate company names? Create your free account to get your API key and start integrating in minutes: Register. For endpoint details and field definitions, check the Documentation.

Ready to use Klazify?

Start classifying websites, enriching company data, and exploring web intelligence.

Get Started Free