{ "Venue" : [
{ "venue_id":"1", "name":"Starbucks"},
{ "venue_id":"2", "name":"Tim Hortons"}
],
"Event" : [
{ "event_id":"1", "name":"EVent1"},
{ "event_id":"2", "name":"EVent1"}
]
}
I have a php page, "data.php" which will echo the data in the above json format.
But if I set up php header of "data.php" as this
header('Content-type: application/json');
Browser firefox cannot open "data.php", it will pop up a window said "this is a php file. do you want to open it with dreamwever or do you want to save it on disk?"
But if I set up the header like
header('Content-Type: text/plain, charset=utf-8');
The data.php is working fine.
The right header for Json is
header('Content-type: application/json');
So which header I am supposed to use?
Or header('Content-type: application/json'); is for the json file. But the data output in json format should still use header('Content-Type: text/plain, charset=utf-8'); ?