Your php code is fine.
Test your response header by calling the url with curl

Code: 
curl -I http://your.url