I need to get the content-type of PHP for "security reasons". For example, if you used the function header("Content-type: text/html; charset=utf-8")
, how, at a future time of execution, I can receive the content-type (text/html
) and charset (utf-8
) separately?
My real problem is knowing which charset is being used and modify only it, if necessary, without having to redefine the information Content-type
. Ie if content-type is application/xml
, keep it, but change the only charset.
Ex.
Original: Content-type: text/html
First: -> set to application/xml.
Content-type: application/xml
Second: -> set charset.
Content-type: application/xml; charset=utf-8
Third: -> set to text/html
Content-type: text/html; charset=utf-8
How it is possible?