Validate llms.txt File in PHP
The llms.txt specification tells AI systems which pages to prioritize and how to cite your content. This endpoint validates your llms.txt file against the spec, checks for common mistakes, and suggests improvements.
Endpoint
POST /api/v1/llmstxt/validate
PHP Code
$ch = curl_init("https://seodiff.io/api/v1/llmstxt/validate");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SEODIFF_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => '{"url":"https://example.com/llms.txt"}',
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
echo "Status: " . ($response["status"] ?? "unknown") . "\n";Example Response
{"valid":true,"warnings":["Consider adding a 'preferred-citation' field"],"sections_found":3,"urls_listed":12}All requests require an API key in the Authorization: Bearer header. Get your API key →
Same Endpoint, Other Languages
More PHP Examples
Evaluate pSEO Pages
Test programmatic pages against assertion rules. The core agentic evaluation endpoint.
Scan a Website
Enqueue a surface scan for diff detection and SEO regression identification.
Validate in CI/CD Pipeline
CI-friendly endpoint that blocks deployments when SEO regressions are detected.
Trigger Deep Audit
Start a comprehensive multi-page crawl with PageRank, link analysis, and pSEO diagnostics.
Google Search Console Data Sync
Pull GSC performance data into SEODiff for correlation with AI-readiness metrics.