Shorten URL with TinyURL


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



Copy this code and paste it in your HTML
  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

You need to login to post a comment.