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...
It's no secret that Facebook has become a major traffic driver for all types of websites. Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly. And of course there are Facebook "Like" and "Recommend" widgets on every website. One...
If you follow me on Twitter, you saw me rage about trying to make position: absolute
work within a TD
element or display: table-cell
element. Chrome? Check. Internet Explorer? Check. Firefox? Ugh, FML. I tinkered in the console...and cussed. I did some researched...and I...
Last week I showed you how you could style selected text with CSS. I've searched for more interesting CSS style properties and found another: INPUT
placeholder styling. Let me show you how to style placeholder text within INPUT
elements with some unique CSS code.
The CSS
Firefox...
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
:)