API Documentation

Service/Technorati.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Service
subpackage
Technorati
version
$Id: Technorati.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Service_Technorati

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Service_Technorati

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Service
subpackage
Technorati
Constants
API_URI_BASE
API_PATH_COSMOS
API_PATH_SEARCH
API_PATH_TAG
API_PATH_DAILYCOUNTS
API_PATH_TOPTAGS
API_PATH_BLOGINFO
API_PATH_BLOGPOSTTAGS
API_PATH_GETINFO
API_PATH_KEYINFO
PARAM_LIMIT_MIN_VALUE
PARAM_LIMIT_MAX_VALUE
PARAM_DAYS_MIN_VALUE
PARAM_DAYS_MAX_VALUE
PARAM_START_MIN_VALUE
Properties
$_apiKey
$_restClient
Methods
__construct
cosmos
search
tag
dailyCounts
topTags
blogInfo
blogPostTags
getInfo
keyInfo
getApiKey
getRestClient
setApiKey
_validateCosmos
_validateSearch
_validateTag
_validateDailyCounts
_validateGetInfo
_validateTopTags
_validateBlogInfo
_validateBlogPostTags
_validateInArrayOption
_validateMandatoryOption
_validateIntegerOption
_makeRequest
_validateOptionClaim
_validateOptionFormat
_validateOptionLimit
_validateOptionStart
_validateOptionUrl
_checkErrors
_convertResponseAndCheckContent
_checkResponse
_compareOptions
_prepareOptions

Description

Zend_Service_Technorati provides an easy, intuitive and object-oriented interface for using the Technorati API.

It provides access to all available Technorati API queries and returns the original XML response as a friendly PHP object.

Constants

API_URI_BASE

 API_URI_BASE = 'http://api.technorati.com'

Base Technorati API URI

Details

value
http://api.technorati.com

API_PATH_COSMOS

 API_PATH_COSMOS = '/cosmos'

Query paths

Details

value
/cosmos

API_PATH_SEARCH

 API_PATH_SEARCH = '/search'

Details

value
/search

API_PATH_TAG

 API_PATH_TAG = '/tag'

Details

value
/tag

API_PATH_DAILYCOUNTS

 API_PATH_DAILYCOUNTS = '/dailycounts'

Details

value
/dailycounts

API_PATH_TOPTAGS

 API_PATH_TOPTAGS = '/toptags'

Details

value
/toptags

API_PATH_BLOGINFO

 API_PATH_BLOGINFO = '/bloginfo'

Details

value
/bloginfo

API_PATH_BLOGPOSTTAGS

 API_PATH_BLOGPOSTTAGS = '/blogposttags'

Details

value
/blogposttags

API_PATH_GETINFO

 API_PATH_GETINFO = '/getinfo'

Details

value
/getinfo

API_PATH_KEYINFO

 API_PATH_KEYINFO = '/keyinfo'

Details

value
/keyinfo

PARAM_LIMIT_MIN_VALUE

 PARAM_LIMIT_MIN_VALUE = '1'

Prevent magic numbers

Details

value
1

PARAM_LIMIT_MAX_VALUE

 PARAM_LIMIT_MAX_VALUE = '100'

Details

value
100

PARAM_DAYS_MIN_VALUE

 PARAM_DAYS_MIN_VALUE = '1'

Details

value
1

PARAM_DAYS_MAX_VALUE

 PARAM_DAYS_MAX_VALUE = '180'

Details

value
180

PARAM_START_MIN_VALUE

 PARAM_START_MIN_VALUE = '1'

Details

value
1

Properties

$_apiKey

string $_apiKey = ''

Technorati API key

Details

$_apiKey
string
visibility
protected
default
final
false
static
false
access
protected

$_restClient

Zend_Rest_Client $_restClient = ''

Zend_Rest_Client instance

Details

$_restClient
Zend_Rest_Client
visibility
protected
default
final
false
static
false
access
protected

Methods

__construct

__construct( string $apiKey ) :

Constructs a new Zend_Service_Technorati instance and setup character encoding.

Arguments
$apiKey
string
Your Technorati API key
Details
visibility
public
final
false
static
false

_checkErrors

_checkErrors( DomDocument $dom ) : void

Checks XML response content for errors.

Arguments
$dom
DomDocument
the XML response as a DOM document
Details
visibility
protected
final
false
static
true
access
protected
link
Technorati API: Error response
throws

_checkResponse

_checkResponse( Zend_Http_Response $response ) : void

Checks ReST response for errors.

Arguments
$response
Zend_Http_Response
the ReST response
Details
visibility
protected
final
false
static
true
access
protected
throws

_compareOptions

_compareOptions( array $options, array $validOptions ) : void

Checks whether user given options are valid.

Arguments
$options
array
user options
$validOptions
array
valid options
Details
visibility
protected
final
false
static
false
access
protected
throws

_convertResponseAndCheckContent

_convertResponseAndCheckContent( Zend_Http_Response $response ) : DOMDocument

Converts $response body to a DOM object and checks it.

Arguments
$response
Zend_Http_Response
Output
DOMDocument
Details
visibility
protected
final
false
static
false
access
protected
throws
if response content contains an error message

_makeRequest

_makeRequest( string $path, array $options = array ) : Zend_Http_Response

Makes and HTTP GET request to given $path with $options.

HTTP Response is first validated, then returned.

Arguments
$path
string
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws
on failure

_prepareOptions

_prepareOptions( array $options, array $defaultOptions ) : array

Prepares options for the request

Arguments
$options
array
user options
$defaultOptions
array
default options
Output
array
Merged array of user and default/required options.
Details
visibility
protected
final
false
static
false
access
protected

_validateBlogInfo

_validateBlogInfo( array $options ) : void

Validates BlogInfo query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateBlogPostTags

_validateBlogPostTags( array $options ) : void

Validates TopTags query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateCosmos

_validateCosmos( array $options ) : void

Validates Cosmos query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateDailyCounts

_validateDailyCounts( array $options ) : void

Validates DailyCounts query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateGetInfo

_validateGetInfo( array $options ) : void

Validates GetInfo query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateInArrayOption

_validateInArrayOption( string $name, array $options, array $array ) : void

Checks whether an option is in a given array.

Arguments
$name
string
option name
$options
array
$array
array
array of valid options
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateIntegerOption

_validateIntegerOption(  $name, array $options ) : void

Checks whether $name option is a valid integer and casts it.

Arguments
$name
$options
array
Details
visibility
protected
final
false
static
false
access
protected

_validateMandatoryOption

_validateMandatoryOption(  $name, array $options ) : void

Checks whether mandatory $name option exists and it's valid.

Arguments
$name
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateOptionClaim

_validateOptionClaim( array $options ) : void

Checks whether 'claim' option value is valid.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected

_validateOptionFormat

_validateOptionFormat( array $options ) : void

Checks whether 'format' option value is valid.

Be aware that Zend_Service_Technorati supports only XML as format value.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws
if 'format' value != XML

_validateOptionLimit

_validateOptionLimit( array $options ) : void

Checks whether 'limit' option value is valid.

Value must be an integer greater than PARAM_LIMIT_MIN_VALUE and lower than PARAM_LIMIT_MAX_VALUE.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws
if 'limit' value is invalid

_validateOptionStart

_validateOptionStart( array $options ) : void

Checks whether 'start' option value is valid.

Value must be an integer greater than 0.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws
if 'start' value is invalid

_validateOptionUrl

_validateOptionUrl( array $options ) : void

Checks whether 'url' option value exists and is valid.

'url' must be a valid HTTP(s) URL.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws
if 'url' value is invalid
todo
support for Zend_Uri_Http

_validateSearch

_validateSearch( array $options ) : void

Validates Search query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateTag

_validateTag( array $options ) : void

Validates Tag query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

_validateTopTags

_validateTopTags( array $options ) : void

Validates TopTags query options.

Arguments
$options
array
Details
visibility
protected
final
false
static
false
access
protected
throws

blogInfo

blogInfo( string $url, array $options = null ) : Zend_Service_Technorati_BlogInfoResult

BlogInfo provides information on what blog, if any, is associated with a given URL.

Arguments
$url
string
the URL you are searching for. Prefixes http:// and www. are optional. The URL must be recognized by Technorati as a blog.
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: BlogInfo Query reference
throws

blogPostTags

blogPostTags( string $url, array $options = null ) : Zend_Service_Technorati_TagsResultSet

BlogPostTags provides information on the top tags used by a specific blog.

Query options include:

'limit' => (int) optional - adjust the size of your result from the default value of 20 to between 1 and 100 results. 'start' => (int) optional - adjust the range of your result set. Set this number to larger than zero and you will receive the portion of Technorati's total result set ranging from start to start+limit. The default start value is 1. Note. This property is not documented.

Arguments
$url
string
the URL you are searching for. Prefixes http:// and www. are optional. The URL must be recognized by Technorati as a blog.
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: BlogPostTags Query reference
throws

cosmos

cosmos( string $url, array $options = null ) : Zend_Service_Technorati_CosmosResultSet

Cosmos query lets you see what blogs are linking to a given URL.

On the Technorati site, you can enter a URL in the searchbox and it will return a list of blogs linking to it. The API version allows more features and gives you a way to use the cosmos on your own site.

Query options include:

'type' => (link|weblog) optional - A value of link returns the freshest links referencing your target URL. A value of weblog returns the last set of unique weblogs referencing your target URL. 'limit' => (int) optional - adjust the size of your result from the default value of 20 to between 1 and 100 results. 'start' => (int) optional - adjust the range of your result set. Set this number to larger than zero and you will receive the portion of Technorati's total result set ranging from start to start+limit. The default start value is 1. 'current' => (true|false) optional - the default setting of true Technorati returns links that are currently on a weblog's homepage. Set this parameter to false if you would like to receive all links to the given URL regardless of their current placement on the source blog. Internally the value is converted in (yes|no). 'claim' => (true|false) optional - the default setting of FALSE returns no user information about each weblog included in the result set when available. Set this parameter to FALSE to include Technorati member data in the result set when a weblog in your result set has been successfully claimed by a member of Technorati. Internally the value is converted in (int). 'highlight' => (true|false) optional - the default setting of TRUE highlights the citation of the given URL within the weblog excerpt. Set this parameter to FALSE to apply no special markup to the blog excerpt. Internally the value is converted in (int).

Arguments
$url
string
the URL you are searching for. Prefixes http:// and www. are optional.
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: Cosmos Query reference
throws

dailyCounts

dailyCounts(  $query, array $options = null ) : Zend_Service_Technorati_DailyCountsResultSet

TopTags provides daily counts of posts containing the queried keyword.

Query options include:

'days' => (int) optional - Used to specify the number of days in the past to request daily count data for. Can be any integer between 1 and 180, default is 180

Arguments
$query
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: DailyCounts Query reference
throws

getApiKey

getApiKey( ) : string

Returns Technorati API key.

Output
string
Technorati API key
Details
visibility
public
final
false
static
false

getInfo

getInfo( string $username, array $options = null ) : Zend_Service_Technorati_GetInfoResult

GetInfo query tells you things that Technorati knows about a member.

The returned info is broken up into two sections: The first part describes some information that the user wants to allow people to know about him- or herself. The second part of the document is a listing of the weblogs that the user has successfully claimed and the information that Technorati knows about these weblogs.

Arguments
$username
string
the Technorati user name you are searching for
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: GetInfo reference
throws

getRestClient

getRestClient( ) : Zend_Rest_Client

Returns a reference to the REST client object in use.

If the reference hasn't being inizialized yet, then a new Zend_Rest_Client instance is created.

Details
visibility
public
final
false
static
false

keyInfo

keyInfo( ) : Zend_Service_Technorati_KeyInfoResult

KeyInfo query provides information on daily usage of an API key.

Key Info Queries do not count against a key's daily query limit.

A day is defined as 00:00-23:59 Pacific time.

Details
visibility
public
final
false
static
false
link
Technorati API: Key Info reference
throws

search

search( string $query, array $options = null ) : Zend_Service_Technorati_SearchResultSet

Search lets you see what blogs contain a given search string.

Query options include:

'language' => (string) optional - a ISO 639-1 two character language code to retrieve results specific to that language. This feature is currently beta and may not work for all languages. 'authority' => (n|a1|a4|a7) optional - filter results to those from blogs with at least the Technorati Authority specified. Technorati calculates a blog's authority by how many people link to it. Filtering by authority is a good way to refine your search results. There are four settings: - n => Any authority: All results. - a1 => A little authority: Results from blogs with at least one link. - a4 => Some authority: Results from blogs with a handful of links. - a7 => A lot of authority: Results from blogs with hundreds of links. 'limit' => (int) optional - adjust the size of your result from the default value of 20 to between 1 and 100 results. 'start' => (int) optional - adjust the range of your result set. Set this number to larger than zero and you will receive the portion of Technorati's total result set ranging from start to start+limit. The default start value is 1. 'claim' => (true|false) optional - the default setting of FALSE returns no user information about each weblog included in the result set when available. Set this parameter to FALSE to include Technorati member data in the result set when a weblog in your result set has been successfully claimed by a member of Technorati. Internally the value is converted in (int).

Arguments
$query
string
the words you are searching for.
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: Search Query reference
throws

setApiKey

setApiKey( string $key ) : void

Sets Technorati API key.

Be aware that this function doesn't validate the key. The key is validated as soon as the first API request is sent. If the key is invalid, the API request method will throw a Zend_Service_Technorati_Exception exception with Invalid Key message.

Arguments
$key
string
Technorati API Key
Details
visibility
public
final
false
static
false
link
How to get your Technorati API Key

tag

tag( string $tag, array $options = null ) : Zend_Service_Technorati_TagResultSet

Tag lets you see what posts are associated with a given tag.

Query options include:

'limit' => (int) optional - adjust the size of your result from the default value of 20 to between 1 and 100 results. 'start' => (int) optional - adjust the range of your result set. Set this number to larger than zero and you will receive the portion of Technorati's total result set ranging from start to start+limit. The default start value is 1. 'excerptsize' => (int) optional - number of word characters to include in the post excerpts. By default 100 word characters are returned. 'topexcerptsize' => (int) optional - number of word characters to include in the first post excerpt. By default 150 word characters are returned.

Arguments
$tag
string
the tag term you are searching posts for.
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
throws
@link http://technorati.com/developers/api/tag.html Technorati API: Tag Query reference

topTags

topTags( array $options = null ) : Zend_Service_Technorati_TagsResultSet

TopTags provides information on top tags indexed by Technorati.

Query options include:

'limit' => (int) optional - adjust the size of your result from the default value of 20 to between 1 and 100 results. 'start' => (int) optional - adjust the range of your result set. Set this number to larger than zero and you will receive the portion of Technorati's total result set ranging from start to start+limit. The default start value is 1.

Arguments
$options
array
additional parameters to refine your query
Details
visibility
public
final
false
static
false
link
Technorati API: TopTags Query reference
throws
Documentation was generated by DocBlox.