-
-
Save kbrmedia/51aa5173ecd13598ae066e5176a0af9c to your computer and use it in GitHub Desktop.
Premium URL Shortener API PHP Request
This file contains 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 | |
// Using JSON Response | |
$api_url="http://yoursite.com/api?key=APIKEY&url=THELONGURLTOBESHORTENED&custom=CUSTOMALIAS"; | |
$res= @json_decode(file_get_contents($api_url),TRUE); | |
if($res["error"]){ | |
echo $res["msg"]; | |
}else{ | |
echo $res["short"]; | |
} | |
// Using Plain Text Response | |
$api_url="http://yoursite.com/api?api=APIKEY&url=THELONGURLTOBESHORTENED&custom=CUSTOMALIAS&format=text"; | |
$res= @file_get_contents($api_url); | |
if($res){ | |
echo $res; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment