我正在嘗試將Google安全瀏覽API集成到我的網站。該documentation:Google安全瀏覽API未響應 - 發送迴應狀態
我曾嘗試:
$apiKey = 'MyFakeAPiKey-pozpkefpoqskpfazejsqpi';
$url = 'http://www.bbc.com/';
$url = urlencode($url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://sb-ssl.google.com/safebrowsing/api/lookup?client=firefox&key='. $apiKey.'&appver=1.5.2&pver=4.0&url='.$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Content-Type: application/json";
$headers[] = "Content-length: auto";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
echo print_r($result, true);
我沒有得到任何response.What我做錯了嗎?
如果這是您真正的API密鑰,您應該立即使其無效** _ **。它永遠是妥協的,你需要生成一個新的。 – Chris
謝謝克里斯,但我在問題的底部指出,這個關鍵不是真實的。 – Mkey