Service/ShortUrl/BitLy.php
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.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Service_ShortUrl
- Version
- $Id$
\Zend_Service_ShortUrl_BitLy
Package: Zend_Service_ShortUrl






Bit.ly API implementation
- Parent(s)
- \Zend_Service_ShortUrl_AbstractShortener < \Zend_Service_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


string $_apiUri = 'http://api.bitly.com'
Base URI of the service
Default value
'http://api.bitly.com'
Details- Type
- string
Methods


__construct(string $login, null | string $apiKey = null) : void
Parameters
Name | Type | Description |
---|---|---|
$login | string | user login name or application access token |
$apiKey | null | string | user API key |


_processRequest() : string
handle bit.ly response
Returns
Throws
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Service_ShortUrl_Exception |


setApiLogin( $login, $apiKey) : \Zend_Service_ShortUrl_BitLy
set login credentials
Parameters
Returns
Name | Type | Description |
---|---|---|
$login | ||
$apiKey |
Type | Description |
---|---|
\Zend_Service_ShortUrl_BitLy |


setOAuthAccessToken( $accessToken) : \Zend_Service_ShortUrl_BitLy
set OAuth credentials
Parameters
Returns
Name | Type | Description |
---|---|---|
$accessToken |
Type | Description |
---|---|
\Zend_Service_ShortUrl_BitLy |


shorten(string $url) : string
This function shortens long url
Parameters
Returns
Throws
Name | Type | Description |
---|---|---|
$url | string | URL to Shorten |
Type | Description |
---|---|
string | Shortened Url |
Exception | Description |
---|---|
\Zend_Service_ShortUrl_Exception | if bit.ly reports an error |


unshorten(string $shortenedUrl) : string
Reveals target for short URL
Parameters
Returns
Throws
Name | Type | Description |
---|---|---|
$shortenedUrl | string | URL to reveal target of |
Type | Description |
---|---|
string | Unshortened Url |
Exception | Description |
---|---|
\Zend_Service_ShortUrl_Exception | if bit.ly reports an error |