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

Encurtando URL’s

<?php

include_once(“bitly.php”);

$bitly = new Bitly();
$bitly→url = ‘http://www.google.com/’;
$bitly→shorten();
echo $bitly→getData()→shortUrl;
echo $bitly→getData()→userHash;

?>

Acessando a URL Expandida

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

echo $bitly→getData()→longUrl;
?>

Acessando as informações de uma URL encurtada

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

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

Acessando as estatísticas de uma URL encurtada

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

Debugando o Bitly-PHP

<?php

include_once(“bitly.php”);

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

?>

Clone this wiki locally