Posted By

mrgee on 12/26/09


Tagged

tinyurl


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

ginoplusio
mrgee
rene-design
jlan
BrianCoyDesign
clac


Shorten URL with TinyURL


 / Published in: PHP
 

  1. <?
  2. function ShortURL($ToConvert) {
  3. $short_url= file_get_contents('http://tinyurl.com/api-create.php?url=' . $ToConvert);
  4. return $short_url;
  5. }
  6.  
  7. $newurl = ShortURL('http://freepublic.info'); // shorten this URL
  8. echo $newurl;
  9. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ginoplusio on December 29, 2009

Nice function. I've made the decode function here: http://snipplr.com/view/25668/php-tiny-url-encode-and-decode-functions/

You need to login to post a comment.