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.
Today we get to play amazing games on our super powered game consoles, PCs, VR headsets, and even mobile devices. While I enjoy playing new games these days, I do long for the retro gaming systems I had when I was a kid: the original Nintendo...
Two years ago I documented my struggles with Imposter Syndrome and the response was immense. I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions. I've even caught myself reading the post...
In the past we've tinkered with link nudging with MooTools and link nudging with jQuery. In an effort to familiarize myself with other JavaScript frameworks, we're going to try to duplicate that effect with another awesome framework: Dojo.
The JavaScript: Attempt...
CSS background animation has been a hot topic for a long time, mostly because they look pretty sweet and don't require additional elements. I was recently asked if it was possible to have multiple background animations on a given element and the answer is yes...with...
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
:)