Skip to content

Instantly share code, notes, and snippets.

@ngocnb
Forked from MikeRogers0/tiny-url-api.php
Created September 21, 2020 02:54
Show Gist options
  • Save ngocnb/bd012fc9ace46cce38d9ff08e031680e to your computer and use it in GitHub Desktop.
Save ngocnb/bd012fc9ace46cce38d9ff08e031680e 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
*/
?>
@ngocnb
Copy link
Author

ngocnb commented Sep 21, 2020

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.

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