Created
October 8, 2021 11:31
-
-
Save berkes/aa4ada274c0d44dd6747cca3beed327e to your computer and use it in GitHub Desktop.
URL shortner without storage
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 | |
composer require "tuupola/base85:^1.0" | |
$url = "https://ultimatemotherfuckingwebsite.com/" | |
$base85 = new Tuupola\Base85; | |
$tokenized = $base85->encode($url); | |
$shortened = "https://big.pm/$tokenized"; | |
print("The URL $url, is shorthened to $shortened"); | |
$long = array_pop(explode('/', $shortened)); | |
print("redirecting to: $long") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment