What would cause a PHP response to have some extra whitespace at the beginning?

eddiehedgehog

New Member
I have identical code on my production and local *AMP servers. I've created a webservice that returns JSON in the response. However, on my production platform, when the service responds, I get an extra whitespace (a tab) at the beginning of my response. Even after removing the output for the JSON, there is a tab at the beginning of the file. If I \[code\]exit;\[/code\] completely from the beginning of the script that creates the JSON response, the whitespace goes away. There isn't any other place that I can see that would add this extra whitespace, and it doesn't add it in my development sandbox. Is there something I'm missing? Has anyone ever has this problem?Here's some of the code I'm using:\[code\]require_once('includes/config.php');function checkIfExists($parameterName) { if (!isset($_REQUEST[$parameterName])) { throw new AppException("Missing parameter '$parameterName'"); } if (!$value = http://stackoverflow.com/questions/3725373/trim($_REQUEST[$parameterName])) { throw new AppException("Missing parameter '$parameterName'"); } return $value;}try { //my try block, this is where i create an array and then echo out a json_encoded string} catch (AppException $e) { //my catch block here}\[/code\]
 
Back
Top