6

i have a webservice and a web interface for registered user. this section allow the user to get their statistics (similar to stack overflow)

  • number of views
  • number of answers
  • number of post
  • number of support ticket etc...

now this tool i have allow the user to retreive their data in a json format, my problem is the header sent is not working for all the browsers

i have:

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 00:00:00 GMT');
header('Content-type: text/json');

should i remove the expires and cache control?

Joanna Lancaster
  • 681
  • 1
  • 6
  • 13

2 Answers2

9

The commonly accepted MIME for json is application/json.

Tom van der Woerdt
  • 28,143
  • 7
  • 67
  • 105
4

You should use:

header('Content-type: application/json');

See also: What is the correct JSON content type?

Community
  • 1
  • 1
Rob W
  • 315,396
  • 71
  • 752
  • 644