Handling JSON contentType in PHP -

http://thecurlybraces.com/handling-json-contenttype-in-php/