Skip to content

Instantly share code, notes, and snippets.

@0xnbk
Created September 13, 2010 04:35
Show Gist options
  • Save 0xnbk/576816 to your computer and use it in GitHub Desktop.
Save 0xnbk/576816 to your computer and use it in GitHub Desktop.
Get short urls for Twitter
<?php
function getTinyUrl($url) {
return file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
}
?>
@0xnbk
Copy link
Author

0xnbk commented Sep 13, 2010

Get short urls for Twitter

Are you on Twitter? If yes, you probably use a url shortener such as bit.ly or TinyUrl to share your favorite blog posts and links on the network.
This snippet take a url as a parameter and will return a short url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment