PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Additional Bit.ly Methods

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.

<?php
$bitly 
= new Zend_Service_ShortUrl_BitLy('username','apiKey');

// Shorten a URL:
$short $bitly->shorten('http://framework.zend.com/'); // http://bit.ly/15Oe0

// Inflate or unshorten a short URL:
$long  $bitly->unshorten('http://bit.ly/15Oe0'); // http://framework.zend.com/
setApiLogin($login, $apiKey);

Takes the required $login username and $apiKey and passes it to the service.

setOAuthAccessToken($accessToken);

Use the OAuth $accessToken for authentication

Zend Framework