Author Topic: return format  (Read 1487 times)


  • Newbie
  • *
  • Posts: 13
    • View Profile
return format
« on: December 28, 2008, 07:52:19 am »
I am using TinyMVC as a framework for building services, or simple APIs.  I would like to be able to add a return format to the end of the url.  For example

would return xml

would return json

any ideas how this could be done?




  • Administrator
  • Sr. Member
  • *****
  • Posts: 275
    • View Profile
Re: return format
« Reply #1 on: December 28, 2008, 09:33:26 am »
The content type is set by your PHP application:

Code: [Select]
header("Content-type: text/xml");
// spit out xml here

As for the URL, you could do something like:

Then grab the third uri segment and use the suffix to determine the content type.