← All integrations
Languages

SitemapKit + PHP

Call the SitemapKit API from PHP using cURL. Ideal for WordPress plugins, Laravel applications, and PHP-based SEO tools.

Quick Start

<?php
$apiKey = 'YOUR_API_KEY';

$ch = curl_init('https://sitemapkit.com/api/v1/sitemap/full');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        "x-api-key: $apiKey",
    ],
    CURLOPT_POSTFIELDS => json_encode(['url' => 'example.com']),
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Found " . count($data['sitemaps']) . " sitemaps\n";
echo "Extracted " . count($data['urls']) . " URLs\n";

// Filter blog posts
$blogUrls = array_filter($data['urls'], function($u) {
    return strpos($u['loc'], '/blog/') !== false;
});

How it works

  1. Get your API key — Sign up for a free SitemapKit account to get your sk_live_* API key.
  2. Call the API — Use the /api/v1/sitemap/full endpoint to discover and extract all sitemaps from a domain in one call.
  3. Process the data — The response includes structured JSON with all URLs, lastmod dates, and sitemap metadata.

API Endpoints

  • POST /api/v1/sitemap/discover — Find all sitemaps on a domain
  • POST /api/v1/sitemap/extract — Parse a sitemap URL and extract all URLs
  • POST /api/v1/sitemap/full — Discover + extract in one call (recommended)

Start using SitemapKit with PHP

100 free API calls/month. No credit card required.

More Languages integrations