My Twitter

Tiny URL API

March 6th, 2009

Believe it or not, TinyURL has an API which allows you to instantly create TinyURL’s of links. Luckily it’s also free to use and currently does not require resistration.

All you need to do is send a request to:

http://tinyurl.com/api-create.php?url=URL_HERE

The code

<?php
echo file_get_contents('http://tinyurl.com/api-create.php?url='.'http://www.example.com/');

/* For example

http://tinyurl.com/api-create.php?url=http://www.fullondesign.co.uk/

Would return:

http://tinyurl.com/d4px9f

*/
?>
DeliciousFacebookDigg
TwitterStumbleUponGoogleLinkedInRSS Feed

4 Responses to “ Tiny URL API ”

  1. Native B said:

    Hi Mike,

    Have you tried the API for short urls at http://101.gs? They have a web service version but I am not sure which is best to use – Web services or Remote call.

    NB

  2. Mike said:

    Thanks for the comment :) I haven’t used their API yet, but I’ll give it a go and write a post on which is best.

  3. dan said:

    Thank you for the example.

    What if:

    I need to make shorter multiple links. All that i need is a shorter url for each.

    Do you have any clue ?

    thank you.

  4. Mike said:

    You can just reuse the function for each link.

Leave a Reply