I am using the get parameters so the user can choose XML output or Json. Upon their choice it either runs a json function or a xml function, on the same page. However, despite my efforts, even though the code is never told to enter the XML function while json is selected, it still runs the header("Content-type: text/xml"); within the XML function. It does not run anything else. The problem is when it attempts to write:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/json");
In the json function, it gives me an error that the header has already been altered (even though I never executed the XML function. I had to remedy that by making a separate webpage, one for json and one for xml. However, I would like them to goto the same URL and grab the gets to select if they want json or XML without any errors. Is there an easier way to do this?