Skip to content

Instantly share code, notes, and snippets.

Created February 9, 2013 13:11
Show Gist options
  • Save anonymous/4745269 to your computer and use it in GitHub Desktop.
Save anonymous/4745269 to your computer and use it in GitHub Desktop.
/************* some_data.php **************/
<?php
$content = @file_get_contents("http://doma.in/api/?url=http://www.google.com&api=APIKEY");
echo $content;
?>
/************* jquery **************/
$.getJSON('some_data.php', function(data) {
if(!data.error){ // If there is no error
alert(data.short) //Outputs the short url
}else{
alert(data.msg)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment