http://get.sh/api/?url=http://en.wikipedia.org/wiki/URL_shortening
http://get.sh/nTm
<?php /* your code */ $request = 'http://get.sh/api/?url='.urlencode($longurl); $shorturl = file_get_contents($request); if (substr($shorturl, 0, 4) == 'http') { echo 'short-url:'.$shorturl: } else { echo 'error:'.$shorturl: } /* your code */ ?>