rest.akismet.com/1.1/submit-spam Submitting missed spam
api-key.rest.akismet.com/1.1/submit-ham Submitting content incorrectly marked as spam
Table 11.3 The resource provided by the Akismet API
The Akismet API provides a small choice of resources, shown in table 11.3, from which we will choose
the resource to verify that the API key obtained from Wordpress.com is valid. The first thing we will do is
attempt to use Zend_Rest to access this resource in the method demonstrated in the manual as we have in
listing 11.10.
Listing 11.10 A REST request to Akismet using Zend_Http_Client
$client = new Zend_Rest_Client('http://rest.akismet.com/1.1/verify-key'); A
echo $client->key('f6k3apik3y') B
->blog('http://places/') C
->post(); D
A Instantiate the client with the URL of the resource
B Set the key ???key??™ to the value of the API key
Licensed to Menshu You
Zend Framework in Action (Ch01) Manning Publications Co. 31
C Set the key ???blog??™ to the URL of the blog
D Send the request as an HTTP POST
In this example we construct our client with the URL of the verify key resource then, using the fluent
interface that is common in many Zend Framework components, we set the two required variables ???key??? and
???blog??? using the built in magic methods, finally we send them via an HTTP POST request.
Pages:
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334