Skip to content

Instantly share code, notes, and snippets.

@MikeRogers0
Created June 10, 2012 22:26
Show Gist options
  • Select an option

  • Save MikeRogers0/2907534 to your computer and use it in GitHub Desktop.

Select an option

Save MikeRogers0/2907534 to your computer and use it in GitHub Desktop.
Tiny URL API
<?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
*/
?>
@oscarsantiago

Copy link
Copy Markdown

Ya no funciona!!

@Nixuge

Nixuge commented Feb 10, 2020

Copy link
Copy Markdown

Ya no funciona!!

It does work*

@Mr-Ventures

Copy link
Copy Markdown

Wow very powerful, nice!

@dante-nl

Copy link
Copy Markdown

Works! I’m personally going to use it in Shortcuts

@rdileepa

rdileepa commented May 7, 2020

Copy link
Copy Markdown

Superb, thanks for sharing..

@dalelantofindshare

Copy link
Copy Markdown

thank you so much the most powerful one liner api I have ever used.

@UFO-84

UFO-84 commented Jul 29, 2020

Copy link
Copy Markdown

You can use with alias (nice key) also.
Ex: https://tinyurl.com/api-create.php?url=https://drivebird.com&alias=newdrivebird
Please note the alias must be available in their database as well as minimum 5 character long.

@laneboyandrew

Copy link
Copy Markdown

The best solution, thank you so much

@drewmerk

Copy link
Copy Markdown

Does anybody know if tinyurl.com enforces any rate limits or throttling on this endpoint?

@Deepanshusuman

Copy link
Copy Markdown

it is not working for me also giving 'Error' for custom alias

@drewmerk

Copy link
Copy Markdown

it is not working for me also giving 'Error' for custom alias

That could be because you are using a custom alias that is already in use. Try a different custom alias.

@notetosiraj

Copy link
Copy Markdown

Hi ,it is working for me tested 10 dynamic url .Shall we use this for 1 lakh to generate dynamic url and has tinyurl officially announced API for this.

@usus2020

Copy link
Copy Markdown

cool is working love it

@ivantexsul

Copy link
Copy Markdown

Very Cool! Made my job easier! Thanks!

@billyqureshi

billyqureshi commented May 24, 2021

Copy link
Copy Markdown

This is so useful. I have three questions. Tiny says this is free as it is ad supported. Where are the ads?? Also, are there usage limits on this? And, what happens if a url you submit has already been shortened before ?
The website for its api has documentation for its restful api, there’s no mention of this one. It could stop working at any time !

@itspyguru

itspyguru commented Aug 3, 2021

Copy link
Copy Markdown

Python requests example

import requests

url = 'https://dwhistle.wordpress.com/2020/05/28/who-needed-to-be-saved-us-or-earth/'

base_url = 'http://tinyurl.com/api-create.php?url='
url = base_url + url
r = requests.get(url)
print(r.text)

@Jaytru1997

Jaytru1997 commented Sep 26, 2021

Copy link
Copy Markdown

@nquenault

Copy link
Copy Markdown

Sadly, don't work using POST method

@drewmerk

drewmerk commented Oct 7, 2021

Copy link
Copy Markdown

Sadly, don't work using POST method

It works if you use GET method. Not sure why you'd need to use POST.

@Zulff-GitHub

Copy link
Copy Markdown

Hi there,
I've been using this API since 2020 and it's awesome!

However, suddenly today (20211118) did not get successful response via GET.
Got error code 503.

Please help.

@jvrocamora

jvrocamora commented Nov 18, 2021

Copy link
Copy Markdown

Today, 20211118 doesnt work !!!

Appears a html page with:
Just a moment...

@abhisheksurve45

Copy link
Copy Markdown

try with https

@danouche93

danouche93 commented Nov 18, 2021

Copy link
Copy Markdown

I got error 503 too from this morning, now it's back

@inderjitpassi

Copy link
Copy Markdown

Right @danouche93 it's back now. Thanks

@rickykusriana

Copy link
Copy Markdown

is there a limit to the use of this API?

@AliAryanTech

Copy link
Copy Markdown

Wow, Thanks it's working...

@Techbeastz

Copy link
Copy Markdown

does this still working in right now???

@dardo82

dardo82 commented Nov 11, 2025

Copy link
Copy Markdown

does this still working in right now???

Did you try it? πŸ‘¨β€πŸ’»

@Techbeastz

Copy link
Copy Markdown

does this still working in right now???

Did you try it? πŸ‘¨β€πŸ’»

No thats why I am asking it

@dardo82

dardo82 commented Nov 11, 2025

Copy link
Copy Markdown

does this still working in right now???

Did you try it? πŸ‘¨β€πŸ’»

No thats why I am asking it

Problem solved. πŸ™ƒ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment