Services_Akismet
[ class tree: Services_Akismet ] [ index: Services_Akismet ] [ all elements ]

Class: Services_Akismet_HttpClient_Socket

Source Location: /Services_Akismet-1.0.1/Akismet/HttpClient/Socket.php

Class Overview

Services_Akismet_HttpClient
   |
   --Services_Akismet_HttpClient_Socket

Socket-based simple HTTP client for accessing the Akismet REST API


Author(s):

Copyright:

  • 2007-2008 Bret Kuhns, 2008 silverorange

Methods


Inherited Variables

Inherited Methods

Class: Services_Akismet_HttpClient

Services_Akismet_HttpClient::__construct()
Creates a new HTTP client for accessing the Akismet REST API
Services_Akismet_HttpClient::factory()
Factory method to instantiate a HTTP client implementation
Services_Akismet_HttpClient::post()
Makes a HTTP POST request on the Akismet API server

Class Details

[line 72]
Socket-based simple HTTP client for accessing the Akismet REST API

This socket-based HTTP client requires PHP to support the fsockopen(), fwrite(), fread(), fflush() and fclose() functions.

This HTTP client only supports the HTTP POST method since that is all that is needed for the Akismet API.



[ Top ]


Method Detail

__construct (Constructor)   [line 249]

Services_Akismet_HttpClient_Socket __construct( string $host, integer $port, string $userAgent)

Creates a new TCP/IP socket-based HTTP client for accessing the Akismet REST API

Instances of this HTTP client must be instantiated using the Services_Akismet_HttpClient::factory() method.

  • Access: protected

Overrides Services_Akismet_HttpClient::__construct() (Creates a new HTTP client for accessing the Akismet REST API)

Parameters:

string   $host   —  the Akismet API server host name.
integer   $port   —  the TCP/IP connection port of this HTTP client.
string   $userAgent   —  the HTTP user agent of this HTTP client.

[ Top ]

__destruct (Destructor)   [line 229]

void __destruct( )

Disconnects this HTTP client if it is connected when destroyed
  • Access: public

[ Top ]

post   [line 154]

string post( string $path, string $content, [string $apiKey = ''])

Makes a HTTP POST request on the Akismet API server
  • Return: the content of the HTTP response from the Akismet API server.
  • Throws: Services_Akismet_CommunicationException if there is an error connecting to the Akismet API server, if there is an error sending the HTTP request to the Akismet API server, if there is an error reading the response from the Akismet API server or if the response from the Akismet API server is invalid.
  • Access: public

Overrides Services_Akismet_HttpClient::post() (Makes a HTTP POST request on the Akismet API server)

Parameters:

string   $path   —  the resource to post to.
string   $content   —  the data to post.
string   $apiKey   —  optional. The Wordpress API key to use for the request. If not specified, no API key information is included in the request. This is used for key validation.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:21:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.