Get short urls for Twitter with PHP


/ Published in: PHP
Save to your folder(s)

If you work with Twitter, you probably use a url shortener such as tinyurl.com or bit.ly to share/post your favorite blog posts or important messages with links on the network. This snippet take your url as a parameter and returns a short url.


Copy this code and paste it in your HTML
  1. <?php
  2. function getShortUrl($url){
  3. return file_get_contents('http://tinyurl.com/api-create.php?url='.$url);
  4. }
  5. ?>

URL: http://www.apphp.com/index.php?snippet=php-get-short-urls-for-twitter

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.