接入教程
1. 访问RapidAPI平台注册账号
2. 订阅NoPhishy API服务获取密钥
3. 调用API端点传入待检测链接
4. 接收JSON格式的检测结果
5. 根据结果中的安全标识采取相应措施
Python示例:检测钓鱼链接
python
import requests
url = 'https://api.example.com/v1/check'
headers = {
'X-API-Key': 'YOUR_API_KEY'
}
payload = {
'url': 'https://example.com/suspicious'
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
PHP示例:验证链接安全性
php
<?php
$url = 'https://api.example.com/v1/check';
$data = ['url' => 'https://example.com/suspicious'];
$headers = [
'X-API-Key: YOUR_API_KEY',
'Content-Type: application/json'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
JavaScript示例:实时链接检测
javascript
const url = 'https://api.example.com/v1/check';
const options = {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/suspicious'
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
常见问题
该API支持哪些链接格式?
支持标准的HTTP/HTTPS链接格式,包括带查询参数和路径的完整URL。
数据库更新频率如何?
钓鱼网址数据库实时更新,通常新发现的威胁会在数小时内加入检测列表。
调用API有速率限制吗?
是的,免费版本有每分钟请求次数限制,具体限制请参考API文档。
Aitishiku.com