本指南用于通过 Zyla API Hub 从 PHP 调用 网站分类 API。您传递一个 URL(或电子邮件),然后获得分类路径和置信度。认证为 Authorization: Bearer YOUR_API_KEY。计费为订阅 + 配额,而不是按调用计费。第一个 API:7 天试用或 50 次请求。没有免费计划。
在 zylalabs.com/register 注册一个密钥,然后订阅该列表。下面的 curl 使用 Hub 网关——而不是源主机。
对 URL 进行分类
POST 文档示例 url=https://yahoo.com。这是此端点上唯一的用户字段。
curl -s -X POST "https://zylalabs.com/api/12/website-categorization-api/48/url"
-H "Authorization: Bearer YOUR_API_KEY"
--data-urlencode "url=https://yahoo.com"
在 PHP 中的相同调用:
$ch = curl_init("https://zylalabs.com/api/12/website-categorization-api/48/url");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer YOUR_API_KEY"],
CURLOPT_POSTFIELDS => http_build_query(["url" => "https://yahoo.com"]),
]);
echo curl_exec($ch);
curl_close($ch);
该请求的存储 Hub 示例(已修剪为您首先读取的字段):
{
"domain": {
"categories": [
{"confidence": 0.8140320181846619, "name": "/Internet & Telecom/Other"},
{"confidence": 0.28268808126449585, "name": "/News/Other"},
{"confidence": 0.24724437296390533, "name": "/Internet & Telecom/Search Engines/Other"}
],
"social_media": {
"facebook_url": "https://facebook.com/YahooNews",
"instagram_url": "https://instagram.com/yahoonews",
"youtube_url": "https://www.youtube.com/c/yahoonews"
},
"logo_url": "https://klazify.s3.amazonaws.com/95839267417880239806a9314acc4e7f4.17574915.png"
},
"success": true
}
读取 domain.categories[0].name 和 domain.categories[0].confidence。在此固定装置上,顶级路径为 /Internet & Telecom/Other,置信度为 0.814。
对电子邮件进行分类
兄弟端点。文档示例:[email protected]。
curl -s -X POST "https://zylalabs.com/api/12/website-categorization-api/1989/email"
-H "Authorization: Bearer YOUR_API_KEY"
--data-urlencode "[email protected]"
$ch = curl_init("https://zylalabs.com/api/12/website-categorization-api/1989/email");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer YOUR_API_KEY"],
CURLOPT_POSTFIELDS => http_build_query(["email" => "[email protected]"]),
]);
echo curl_exec($ch);
curl_close($ch);
存储 Hub 示例:
{
"domain": {
"categories": [
{"confidence": 0.9019761085510254, "name": "/Internet & Telecom/Email & Messaging/Email"}
],
"social_media": null,
"logo_url": "https://klazify.s3.amazonaws.com/89059216117865465426a7c896e56cf68.19942511.png"
},
"success": true
}
来自代理
MCP 用于 Hub 列表位于 https://mcp.zylalabs.com/mcp,使用您的 Hub 密钥。上面的 REST 路径仍然是 PHP 的真实来源。
上线
1. 注册 — 您的第一个 Hub API 的 7 天试用。
2. 订阅 网站分类 API。
3. 使用 url=https://yahoo.com POST URL 路径,然后使用 [email protected] POST 电子邮件路径。