Bit.ly API implementation

category Zend
package Zend_Service_ShortUrl
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Service_ShortUrl_AbstractShortener

 Methods

__construct()

__construct(string $login, null|string $apiKey = null

Parameters

$login

string

user login name or application access token

$apiKey

nullstring

user API key

Gets the HTTP client object.

getHttpClient() : \Zend_Http_Client
InheritedStatic

Returns

\Zend_Http_Client

set login credentials

setApiLogin($login, $apiKey) : \Zend_Service_ShortUrl_BitLy

Parameters

$login

$apiKey

Returns

\Zend_Service_ShortUrl_BitLy

Sets the HTTP client object to use for retrieving the feeds. If none is set, the default Zend_Http_Client will be used.

setHttpClient(\Zend_Http_Client $httpClient) 
InheritedStatic

Parameters

$httpClient

\Zend_Http_Client

set OAuth credentials

setOAuthAccessToken($accessToken) : \Zend_Service_ShortUrl_BitLy

Parameters

$accessToken

Returns

\Zend_Service_ShortUrl_BitLy

This function shortens long url

shorten(string $url) : string

Parameters

$url

string

URL to Shorten

Exceptions

\Zend_Service_ShortUrl_Exception if bit.ly reports an error

Returns

stringShortened Url

Reveals target for short URL

unshorten(string $shortenedUrl) : string

Parameters

$shortenedUrl

string

URL to reveal target of

Exceptions

\Zend_Service_ShortUrl_Exception if bit.ly reports an error

Returns

stringUnshortened Url

handle bit.ly response

_processRequest() : string

Exceptions

\Zend_Service_ShortUrl_Exception

Returns

string

prepare http client

_setAccessParameter() : void

Checks whether URL to be shortened is valid

_validateUri(string $url) 
Inherited

Parameters

$url

string

Exceptions

\Zend_Service_ShortUrl_Exception When URL is not valid

Verifies that the URL has been shortened by this service

_verifyBaseUri(string $shortenedUrl) 
Inherited

Parameters

$shortenedUrl

string

Exceptions

\Zend_Service_ShortUrl_Exception If the URL hasn't been shortened by this service

 Properties

 

user API key or application access token

$_apiKey : string

Default

 

Base URI of the service

$_apiUri : string

Default

'http://api.bitly.com'
 

Base URI of the service

$_baseUri : string

Default

null
 

HTTP Client used to query all web services

$_httpClient : \Zend_Http_Client

Default

null
Static
 

user login name

$_loginName : string

Default