[PHP] TinyURL Function

1 replies
[PHP] TinyURL Function

Quick 2minute mock up of a function that lets you convert long ugly url's into sexy small url's. You could prob integrate this into a project or program etc.

Code:
<?php
/*
File    : tinyurl.php
Author  : Vick Kumar
Date    : 27/09/2011
Vers    : 1.0
contact : vickkumar2011@gmail.com
*/

function tinyurl($url)
{
$keepitsimplestupid = file_get_contents('http://tinyurl.com/api-create.php?url='.$url);
return $keepitsimplestupid;
}

echo tinyurl("http://www.warriorforum.com/programming-talk/");

?>
#function #php #tinyurl
  • Profile picture of the author trevorf
    I love it when sites like TinyURL have such a simple API. Makes doing things like this a breeze.
    {{ DiscussionBoard.errors[4759345].message }}

Trending Topics