Brontesaurus Simplistic url shrinking service

Simplistic url shrinking service

Posted on Friday, January 30th, 2009 at 4:49 pm View Comments

http://biturl.cc

This a little url shrinking service I came up with as a side project. Now I know there are a billion other services but a lot of them are really kind of cluttered and I am kind of a control freak when it comes to these things and I thought it would be something fun to do on the side. I also intend to use this as a Ruby on Rails learning project later on.

So the underlying principle with this service is just “no bullshit”. No ads, no big ass clunky interface that fills the entire page. One form, one button, one result. There is a simple REST based api that just returns a straight string. It is bloody simple to implement into any service, take a look at the api documentation http://api.biturl.cc/.

Here’s and example PHP + Curl implementation (taken and modified from twitme wordpress plugin).

$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL,"http://api.biturl.cc/rest.php?u=$url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
 
$sResponse     = curl_exec($ch);
$iResponseCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
 
if ($iResponseCode != 200) return $url;
return $sResponse;
blog comments powered by Disqus
  • Simplistic url shrinking service
  • Simplistic url shrinking service
  • Simplistic url shrinking service
  • Simplistic url shrinking service
  • Simplistic url shrinking service

© 2010 Copyright Brontesaurus. All Rights Reserved. Valid (x)HTML and CSS