Reputation: 2073
I am implementing an API for some service that should return in the content only one character like '0' or '1' with no trailing or leading spaces or html tags.
I tried the following.
header( 'Content-Type:text/plain' );
echo "1";
and
header( 'Content-Type:text/plain' );
print "1";
I also tried to omit the header line, but I always get a new line character at the end of the output.
This is the output of php -v.
PHP 5.3.28 (cli) (built: Dec 15 2013 17:43:05)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
This is the output of httpd -v
Server version: Apache/2.2.23 (Unix)
Server built: Nov 25 2012 15:00:50
Upvotes: 0
Views: 53