function antispam_api_cmd_verify_key in AntiSpam 7
Same name and namespace in other branches
- 6 antispam.module \antispam_api_cmd_verify_key()
AntiSpam API: Key Verification.
Parameters
string $key: API Key.
integer $provider:
Return value
integer See constants ANTISPAM_API_RESULT_xxx.
1 call to antispam_api_cmd_verify_key()
File
- ./
antispam.module, line 2096 - Primary hook implementations for the Antispam module.
Code
function antispam_api_cmd_verify_key($key, $provider) {
global $base_url;
if (empty($key)) {
return ANTISPAM_API_RESULT_ERROR;
}
$api_host = antispam_get_api_host($provider);
$request = 'key=' . $key . '&blog=' . $base_url . base_path();
$response = _antispam_api_http_post($request, $api_host, '/' . ANTISPAM_AKISMET_API_VERSION . '/verify-key');
if (!isset($response[1])) {
watchdog('antispam', "verifying a key: can not get a response back from the service provider " . antispam_get_provider_name($provider, FALSE));
return ANTISPAM_API_RESULT_ERROR;
}
return 'valid' == $response[1] ? ANTISPAM_API_RESULT_SUCCESS : ANTISPAM_API_RESULT_ERROR;
}