|
Cookbook /
ShortURLsSummary: shorten URLs using bit.ly, including a markup expression and a function for further coding
Version: 2009-07-22
Prerequisites: uses JSON, which requires PHP 5.2.0
Status:
Maintainer: overtones99
Download: bit.ly.urlShortening.phpΔ
Questions answered by this recipe
Descriptionshorten URLs using bit.ly Notes"URL Shortening" is a way of converting long, perhaps even multiline, URLs into much, much shorter, more readable ones. It's often used on sites like Twitter where there is a character-limit to messages sent. For example, this cookbook page can also be reached by via the shortened URL, http://bit.ly/VaBzD(approve links). There are many URL shortening services available, and so far this page only deals with those generated by http://bit.ly(approve links). Feel free to add code for other URL shortening services as well. The attached code provides two options for URL shortening:
To use this code:Download bit.ly.urlShortening.phpΔ.
## BIT.LY URL SHORTENING
$bitLy_login = 'yourLogin';
$bitLy_apiKey = 'yourApiKey';
include_once("$FarmD/cookbook/bit.ly.urlShortening.php");
Note that you must first register for a login and apikey from the http://bit.ly(approve links) site - the registration is free. Brief Explanation:This code uses bit.ly's very basic API, which involves sending a call to the bit.ly URL, with arguments attached, like so:
For more information on the API, visit http://code.google.com/p/bitly-api/wiki/ApiDocumentation.
Release notes
See alsoContributors
CommentsUser notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |