Skip to content

Instantly share code, notes, and snippets.

@sclaeys
Last active February 12, 2019 04:08
Show Gist options
  • Save sclaeys/1a2fe783c23cba71a3dfe3ccc9495f63 to your computer and use it in GitHub Desktop.
Save sclaeys/1a2fe783c23cba71a3dfe3ccc9495f63 to your computer and use it in GitHub Desktop.
WEBZ.CC URL Shortener API PHP Request
<?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