I am developing a API with CodeIgniter Framework.
Scenario -
- My application will call my API with http://myapi.com/controler?parA=valA&parB=valB
- My controller will _GET the request and process it.
- Controller will call a view with
$this->load->view('response',$data, true).
My View File -
Response.php
<response>
<status>
200
</status>
<mode>
VisaCreditCard
</mode>
<options>
<option name="Transfer" url="http://myapi.com/controller/transfer?id=8230&reason=illness" />
<option name="Cancel" url="http://myapi.com/controller/cancel?id=3934"/>
<option name="New Booking" url="http://myapi.com/controller/book_new" />
</options>
</response>
Please note that the tag names are the same as I am using in my application although the values inside are vague. This is because I want you to notice the <options> and <option/>.
Problem
Now the problem is when I call my API, CI would do all its jobs and then give out this view where all i get on screen is
200 VisaCreditCard
When I check to see the Source Code of the page I get exactly what I want i.e the text that I have in my respons.php file Expectation I want the source code I got in my output to be on the visible to when I call that url.
Server Information
Ubuntu 13.04
Apache2
PHP 5
Codeigniter 2.1.3 (Rewrite PHP Short Tags - FALSE & .htaccess to omit index.php)