PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Verify an API key

Zend_Service_Akismet::verifyKey($key) is used to verify that an Akismet API key is valid. In most cases, you will not need to check, but if you need a sanity check, or to determine if a newly acquired key is active, you may do so with this method.

<?php
// Instantiate with the API key and a URL to the application or
// resource being used
$akismet = new Zend_Service_Akismet($apiKey,
                                    
'http://framework.zend.com/wiki/');
if (
$akismet->verifyKey($apiKey) {
    echo 
"Key is valid.\n";
} else {
    echo 
"Key is not valid\n";
}

If called with no arguments, verifyKey() uses the API key provided to the constructor.

verifyKey() implements Akismet's verify-key REST method.

Zend Framework