Skip to content

Instantly share code, notes, and snippets.

@cvega93
Created March 12, 2018 14:57
Show Gist options
  • Save cvega93/8c259b7c5dddc22a58c50259c04416a9 to your computer and use it in GitHub Desktop.
Save cvega93/8c259b7c5dddc22a58c50259c04416a9 to your computer and use it in GitHub Desktop.
Acortar enlace con Bitly
$urlCurrent = $_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
function acortar_url($url)
{
$usuario = "o_89kncra68";
$apikey = "R_4f27f66b97292542888d9530443f2cd4";
$temp = "http://api.bit.ly/v3/shorten?login=" . $usuario . "&apiKey=" . $apikey . "&uri=" . $url . "&format=txt";
return file_get_contents($temp);
}
$urlShort = acortar_url($urlCurrent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment