I recently wanted a quick way of looking up HTTP status codes while working with a REST service. I thought it would be great to type this on a command line:

~ $ http 301

and receive a response:

301: Moved Permanently

   The requested resource has been assigned a new permanent URI and any
   future references to this resource SHOULD use one of the returned
   URIs.  Clients with link editing capabilities ought to automatically
   re-link references to the Request-URI to one or more of the new
   references returned by the server, where possible. This response is
   cacheable unless indicated otherwise.

...

So I built httpcode.info.

To get the handy shortcut in your terminal, you should add the following to your .bash_profile (or application file for your preferred shell):

function http(){
    curl http://httpcode.info/$1;
}

The app sniffs User-Agent headers to determine if plain text should be returned. Otherwise, a rough HTML page is returned for browsers.

The data is built from the RFC with a really primitive scraper. All of the code is written in php, since I wanted to run the site on the cheapest hosting I had available at the time.

If there’s interest in improving the app, I’ll post the code to GitHub. Ping me on ADN or Twitter if you’d like to contribute.

Update: check out the source on GitHub.