Obvious Ideas

From the desk of a Software Developer

Archive for the ‘rfc-2324’ tag

How To Create a Teapot with PHP

View Comments

Saw on @toolmantim’s blog that he turned his blog into a tea pot. He even made a Rack middleware that can turn any Rake app into a teapot. “Cool! it can be cool addition to Topify, too”, I thought to myself. The problem? Topify is PHP and not Ruby. The solution? 6 lines of PHP code:

And now you can do :

arikfr:~ arik$ curl -i -X BREW http://topify.com/
HTTP/1.1 418 I’m a teapot
Date: Wed, 13 May 2009 08:51:07 GMT
Server: Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2
X-Powered-By: PHP/5.2.6
Content-Length: 29
Content-Type: text/html

We do serve ICE Tea, though.

It’s not as elegant as Ruby code or Ruby gem, but it does the work.

If you use this on your own server, please ping me. I would love to hear :)

Written by Arik

May 13th, 2009 at 11:05 am

Posted in Software Development

Tagged with , , , , , ,