Exemplo n.º 1
0
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
    <title>Test</title>
</head>
<body>
<?php 
require_once 'lib/bitly.class.php';
include 'config.php';
$bitly = new Bitly($login, $apiKey);
$bitly->setReturnFormat('xml');
try {
    $bitly->error();
} catch (Exception $e) {
    echo '<div>' . $e->getMessage() . '</div>';
}
$url = $bitly->shortenSingle('http://www.ruslanas.com');
//$bitly->setReturnFormat('xml');
//echo $bitly->stats($url);
//exit;
// line below generates error
try {
    $bitly->getThumbnail();
} catch (Exception $e) {
    echo '<div>' . $e->getMessage() . '</div>';
}
$bitly->getInfoArray($url);
$bitly->getStatsArray($url);
echo '<h1>' . $bitly->getTitle() . '</h1>';
echo $bitly->getClicks() . ' clicks<br/>';
echo '<img src="' . $bitly->getThumbnail('medium') . '"/>';