ozcat/url-box

php url shorten

dev-master 2015-10-24 07:27 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:34:27 UTC


README

URL Shorten bundle for PHP

How To Use/Demo

Install

Install with Composer

composer require ozcat/url-box

dwz.cn

$demo = new OzCat\Urlbox\Dwzcn();
$url = "http://url.com";
$bk = $demo->srt($url);
//Restore a url
$long = $demo->expand($bk);
echo $bk;

###is.gd

$demo = new OzCat\Urlbox\Isgd();
$url = "http://url.com";
$bk  = $demo->srt($url);
echo $bk;

###bit.ly You can get your own token at bitly.

$demo = new OzCat\Urlbox\Bitly($key);
$url = "http://url.com";
$bk  = $demo->srt($url);
//Restore a url
$long = $demo->expand($bk);
echo $bk;

###t.cn

please edit the appkey in file class/tcn.class.php before using. You can get your own appkey at sina.

include_once '../class/tcn.class.php';
$demo = new tcn($key);
$url = "http://url.com";
$bk  = $demo->srt($url);
//Restore a url
$long = $demo->expand($bk);
echo $bk;