Content-Type Headers getting stomped?
| From: | Mike Gohlke | Date: | Mon, 14 Aug 2000 22:33:24 +0000 |
| Subject: | Content-Type Headers getting stomped? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11699@lists.php.net to get a copy of this message | ||
Rasmus and others,
I've got the following code which always returns "text/html" for the content type. (I've been using Collin's get_http_headers routine (modified to GET versus HEAD) to verify things.)
Basically, any php script (under 4.0.1pl2 and the current 4.0.2-dev snapshot (lastnights) ) will return "text/html" for the content type no matter what header I return. I know that headers are working as I use php for authentication and it works fine.
Thoughts?
Mike...
<?
if ( $oid < 1 ) { die("oops...no oid"); }
$lnk = mysql_pconnect("yourhost","youruid","yourpass") or die("no connection");
mysql_select_db("nd",$lnk);
$root = "/mydata/usr70/";
$sqlstring = "select news.ftype,fgrp,fdate,fname,ctype from news,contenttype where oid=$oid and contenttype.ftype = news.ftype";
$qry = mysql_query($sqlstring,$lnk) or die("bad qry: ".mysql_error());
$ref = mysql_fetch_object($qry);
Header("Pragma: cache");
Header("Content-type: " . $qry->ctype);
$outgfx = $root . $ref->fgrp . "/" . $ref->fdate . "/" . $ref->fname;
readfile($outgfx);
?>