Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at docs.zendframework.com
Zend_Service_ShortUrl - Zend_Service
URL shorteners have exploded in popularity in the last several years, in large part due to the social nature of the web and the desire to share links. Zend_Service_ShortUrl provides an API for accessing a number of different URL shortener services, with the ability to both create short URLs as well as retrieve the original URL.
Adapters provided include:
Zend_Service_ShortUrl_JdemCz, which accesses the » jdem.cz service.
Zend_Service_ShortUrl_TinyUrlCom, which accesses the » tinyurl.com service.
Zend_Service_ShortUrl_MetamarkNet, which accesses the » metamark.net service.
Zend_Service_ShortUrl_IsGd, which accesses the » is.gd service.
Zend_Service_ShortUrl_BitLy, which accesses the » bit.ly service.
Using one of the URL shortener services is straightforward. Each URL shortener follows a simple interface that defines two methods: shorten() and unshorten(). Instantiate the class, and call the appropriate method.
Takes the given $url and passes it to the service in order to obtain a shortened URL.
If the provided $url is invalid, an exception will be raised.
Takes the provided $shortenedUrl and passes it to the service in order to obtain the original URL.
If the provided $shortenedUrl is invalid, an exception will be raised.
Use this method to set the HTTP client used for communicating with the service.
Use this method to access the HTTP client attached to the service. By default, this will lazy-load an instance of Zend_Http_Client if no client is yet attached.
The bitly API require that authentication credentials be supplied as query arguments. To get started, you'll need a free bitly user account and apiKey. Signup at: » http://bitly.com/a/sign_up
bitly currently also supports the OAuth 2 draft specification. You could provide a generated OAuth access token to Zend_Service_ShortUrl_BitLy using setOAuthAccessToken or as constructor argument.
Takes the required $login username and $apiKey and passes it to the service.
Use the OAuth $accessToken for authentication