Link to home
Start Free TrialLog in
Avatar of ukconcepts
ukconcepts

asked on

HTTP GET

Dear Experts,

I am writing an api for MO messages with http.

Someone should please show me sample codes that can return my message in text/plain?

Thank you.

sample-mo-api.txt
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Olaf Doschke
It's true what Ray says. On top of that, typically a Web server like Apache or IIS is configured to answer a request to a PHP script with a standard header for mime type text/html. This is okay for the normal case PHP is used to create HTML output.

In a PHP script you can override that, unless headers already have been sent. You can check that via headers_sent() and headers_list() will list headers already sent or at least prepared. In case headers have not yet been sent you can use header_remove() to remove them.

And then one of the first function calls made of your php script should be
header('Content-type: text/plain');

Open in new window


and afterwards echo is enough to send text.

If not doing that and staying with the web server default for PHP extension, a strict client might be picky about it, while actually text/html does not differ from text/plain in most cases, a typically UTF-8 encoded html output also contains text in the same single byte encoding as text/plain, the lower 128 chars are identical and include many Latin chars, digits and such.

Bye, Olaf.
Avatar of ukconcepts
ukconcepts

ASKER

Dear experts,

Forgot to mention am a newbie.

HTTP response from Client’s application should look like this:

===========================================
HTTP/1.1 200 OK ??
Date: Mon, 07 Jan 2007 04:55:47 GMT ??
Server: Apache/1.3.19 (Unix) ??
Connection: close ??
Content-Type: text/plain ??
=========================================

Please provide me with php code that could be included in my code above to get this response.

Thank you.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good grief - what was so wrong with the answers that you marked this down a whole letter grade?  You got exactly what you asked for, including detailed responses with tested and working code examples.  What did you expect?  Please explain the marked-down grade, and going forward, please abide by the grading guidelines, thanks.
https://www.experts-exchange.com/help/viewHelpPage.jsp?helpPageID=26