Created
May 10, 2021 18:02
-
-
Save itsmikita/d4e76b473ef140a722f5ed1aff314383 to your computer and use it in GitHub Desktop.
URL Shortener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Shorten URL | |
| * @param $url | |
| * @returns Shortened URL or false on failure | |
| */ | |
| function shorten( $url ) | |
| { | |
| try { | |
| return file_get_contents( "https://clck.ru/--?url={$url}" ); | |
| } | |
| catch( Exception $error ) { | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment