public static function prime() { tiny(); small(); medium(); large(); huge(); }
curl_setopt($sesion, CURLOPT_RETURNTRANSFER, 1); $url_tiny = curl_exec($sesion); curl_close($sesion); } elseif ($type == "isgd") { $isgd = "http://is.gd/api.php?longurl=" . $url_larga; $sesion = curl_init(); curl_setopt($sesion, CURLOPT_URL, $isgd); curl_setopt($sesion, CURLOPT_RETURNTRANSFER, 1); $url_tiny = curl_exec($sesion); curl_close($sesion); } elseif ($type == "unu") { $unu = "http://u.nu/unu-api-simple?url=" . $url_larga; $sesion = curl_init(); curl_setopt($sesion, CURLOPT_URL, $unu); curl_setopt($sesion, CURLOPT_RETURNTRANSFER, 1); $url_tiny = curl_exec($sesion); curl_close($sesion); } elseif ($type == "zima") { $zima = "http://zi.ma/?module=ShortURL&file=Add&mode=API&url=" . $url_larga; $sesion = curl_init(); curl_setopt($sesion, CURLOPT_URL, $zima); curl_setopt($sesion, CURLOPT_RETURNTRANSFER, 1); $url_tiny = curl_exec($sesion); curl_close($sesion); } $url_tiny = $url_tiny . " "; return $url_tiny; } if ($_GET["url"] && $_GET["service"]) { echo tiny($_GET["url"], $_GET["service"]); }
<?php /** * Fansoro Tiny Url Plugin * * (c) Romanenko Sergey / Awilum <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ // Shortcode: {tiny} Shortcode::add('tiny', function ($attributes) { // Extract extract($attributes); return isset($url) ? tiny($url) : ''; }); /** * Takes a long url and uses the TinyURL API to return a shortened version. * * <code> * tiny('http:://sitename.com'); * </code> * * @param string $url Long url * @return string */ function tiny($url) { return isset($url) ? file_get_contents('http://tinyurl.com/api-create.php?url=' . $url) : ''; }