Skip to content
igorescobar edited this page Sep 14, 2010 · 7 revisions

Encurtando URL’s

<?php

include_once(“bitly.php”);

$bitly = new Bitly(‘’,‘’);
echo $bitly→shorten(‘http://www.google.com/’); // out put the shorten url

?>

Acessando a URL Expandida

<?php
$bitly = new Bitly(‘’,‘’);
echo $bitly→expand(‘http://bit.ly/b6R4Uf’); // out put the long url
?>

Acessando as informações de uma URL encurtada

<?php
$bitly = new Bitly(‘’,‘’);
$bitly→info(’’http://bit.ly/b6R4Uf);

//ex

echo $bitly→getData()→thumbnail→medium;

?>

Acessando as estatísticas de uma URL encurtada

<?php
$bitly = new Bitly(‘’,‘’);
$bitly→stats(‘http://bit.ly/b6R4Uf’);
//ex
echo $bitly→getData()→clicks;
?>

Debugando o Bitly-PHP

<?php

include_once(“bitly.php”);

$bitly = new Bitly(‘’,‘’);
$bitly→url = ‘http://www.google.com/’;
$bitly→shorten(’http://www.google.com/’);
// Opcao 1
printr_r($bitly→getData());
//Opcao 2
$bitly→debug();

?>