I have this php page that gets values from a database. From another script on another server, I make a http request to that page and grab the result. The result must be a clean TXT, something like a phrase for example, or a number, or whatever.
When I debug the results I get I see something like this (suppose the answer I was expecting was +OK:server ready+):
+OK:server ready+
1.1 200 OK
I am getting this extra line.
If I make a direct request using a browser, I see +OK:server ready+ but when I look at the page source of that result page I see this:
<html>
<head>
<style type="text/css"></styles>
</head>
<body>
<pre style="word-wrap: break-word; white-space: pre-wrap;">+OK:server ready+</pre>
</body>
</html>
Apparently the browser is adding this, right?
Anyway, the code that generates the line I want is this:
header('Content-Type: text/plain');
echo("+" . $resultFromServer . "+");
is this the correct way to send out a clean text, without any formatting, tag, whatever, from PHP?
thanks.