I've been coding a PHP page that listens for a connection from an embedded
device (a piece of hardware) that sends a POST query to Apache (and to my
PHP pages...).

I've having a problem that I can't seem to solve.  The embedded
application does not set a Content-Type header on the POST, so PHP fails
with the following error:

HTTP/1.1 200 OK
Date: Sun, 26 Aug 2001 05:26:14 GMT
Server: Apache/1.3.12 (Unix)  (Red Hat/Linux) PHP/4.0.2
Connection: close
Content-Type: text/html

<b>Fatal error</b>:  No content-type in POST request in <b>Unknown</b> on
line <b>0</b><br>
Connection closed by foreign host.

The connection that the embedded system makes looks like this:

User-Agent: ImEmbedded
Content-Length: 123
Pragma: no-cache
Cookie: embeddedsession=myverylongsessionvariablegeneratedbythehardware

<?xml version="1.0"?>
And below is some XML stuff...

I've tried setting 'Content-Type' in $HTTP_POST_VARS, using mod_rewrite in
Apache to change the content-type (with the -T flag) and looked at all the
options in php.ini.  I'm using PHP 4.0.2 w/Apache 1.3.12 (if you couldn't
tell from the sig above...)

Nothing works correctly.  The mod_rewrite trick would work, but it makes
everthing to that URL text/xml, including the PHP script, which no longer
executes.  I look on the mailing lists here and on usenet, but I don't see
a good solution...

Anyone have any ideas?  At this point, I'm thinking of re-writing my code
in Perl or Python since there seems to be no solution to this problem.

Note that it's PHP that rejects the request, not Apache.  I don't see why
a missing content-type should do this.  It should just default to
text/plain or something.

Anyway, thanks for any help.


chris maresca
      internet systems architect --

"linux, only up 138 days, because california has flaky power... "

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to