PHP Classes

File: example

Recommend this page to a friend!
  Classes of Ákos Nikházy   bit.ly Class   example   Download  
File: example
Role: Example script
Content type: text/plain
Description: Example for bit.ly class
Class: bit.ly Class
Shorten an URL using the bit.ly API
Author: By
Last change:
Date: 14 years ago
Size: 882 bytes
 

Contents

Class file image Download
<?php
/*************************
 * This is the example file for bit.ly Class.
 * To use it, you have to register on bit.ly and
 * visit http://bit.ly/a/your_api_key here you can
 * find your login and api key you have to use in
 * the class.
 *
 * This example shows the usage of the class. There
 * are two way: you give API key int the clsses
 * private variables OR in the classes construct.
 *
 * After successful shortening you will see all
 * shortened URL in your bit.ly dashboard.
**************************/
require_once 'bit.ly.class.php';

/*USE THIS METHOD IF API KEY PROVIDED INSIDE THE CLASS*/
//$test = new bitlyClass();
//echo $test->getShortURL('http://www.google.com');

$test = new bitlyClass('YOUR BIT.LY LOGIN','YOUR BIT.LY API KEY');
echo
'http://www.google.com shortened version: '.$test->getShortURL('http://www.google.com');

?>