Create an Is.Gd URL Using PHP

By  on  

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.


//gets the data from a URL  
function get_isgd_url($url)  
	//get content
	$ch = curl_init();  
	$timeout = 5;  
	$content = curl_exec($ch);  
	//return the data
	return $content;  

$new_url = get_isgd_url('');

"" is much shorter than "" so if you need the URL to be as short as possible, use this method.

Recent Features

Incredible Demos


  1. Chris

    They do supply an API, you know:

  2. Ah, I’m glad you did this. is my URL ‘shortener’ of choice. :)

    I’m looking forward to the re-design too BTW!

  3. ‘’ has an API! :-)

    This URL will return just the shortened URL: (no confirmation message)

  4. Thanks for the tip guys. I’ve adjusted my article accordingly.

  5. hanoi

    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?



Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!