Create an Is.Gd URL Using PHP
Is.Gd is a URL-shortening service much like TinyURL. Using PHP's cURL library, you can create shortened URLs on the fly with ease.
The PHP
//gets the data from a URL
function get_isgd_url($url)
{
//get content
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,'http://is.gd/api.php?longurl='.$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$content = curl_exec($ch);
curl_close($ch);
//return the data
return $content;
}
//uage
$new_url = get_isgd_url('https://davidwalsh.name/php-imdb-information-grabber');
"is.gd" is much shorter than "tinyurl.com" so if you need the URL to be as short as possible, use this method.
Kids these days, I tell ya. All they care about is the technology. The video games. The bottled water. Oh, and the texting, always the texting. Back in my day, all we had was...OK, I had all of these things too. But I still don't get...
I was inspired when I first saw Addy Osmani's original ShineTime blog post. The hover sheen effect is simple but awesome. When I started my blog redesign, I really wanted to use a sheen effect with my logo. Using two HTML elements and...
Developers everywhere seem to be looking for different ways to make use of JavaScript libraries. Some creations are extremely practical, others aren't. This one may be more on the "aren't" side but used correctly, my TextOverlap plugin could add another interesting design element...
I was recently perusing the MooTools Forge and I saw a neat little plugin that allows for static element rotation: Fx.Rotate. Fx.Rotate is an extension of MooTools' native Fx class and rotates the element via CSS within each A-grade browser it...
They do supply an API, you know: http://is.gd/api_info.php
Ah, I’m glad you did this.
is.gd is my URL ‘shortener’ of choice. :)
I’m looking forward to the re-design too BTW!
‘Is.gd’ has an API! :-)
This URL will return just the shortened URL: (no confirmation message)
http://is.gd/api.php?longurl=http://www.example.com
Thanks for the tip guys. I’ve adjusted my article accordingly.
Hi, How do you highlight PHP syntax in the example above?
Could you show me a list of WordPress plugins you are using on this blog?
Thanhks
:)