Posts

Showing posts with the label tinyURL

Generate A Tinyurl Amongst Php

TinyURL allows you lot to direct keep a long URL similar "http://www.developer-paradize.blogspot.com" in addition to plough it into "http://tinyurl.com/n48rbym". Using the PHP in addition to TinyURL API, you lot tin usage these tiny URLs on the fly!. Simply supply the URL in addition to you'll received the new, tiny URL inward return. PHP <?php //gets the information from a URL business office get_tiny_url($url)  { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); render $data; } //test it out! $new_url = get_tiny_url('http://www.developer-paradize.blogspot.com/'); //returns http://tinyurl.com/n48rbym echo $new_url; ?> If you lot don't desire to role cURL, you lot tin role file_get_contents. PHP <?php business office tinyurl($url) { re...