Last active
February 12, 2019 04:08
-
-
Save sclaeys/1a2fe783c23cba71a3dfe3ccc9495f63 to your computer and use it in GitHub Desktop.
WEBZ.CC 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://webz.cc/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://webz.cc/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