denoteone Posted January 19, 2009 Share Posted January 19, 2009 $headers = "Content-type: text/html; charset=utf-8\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\r\n"; header($headers); this my code on line 35 this is the error message in my http log? PHP Warning: Header may not contain more than a single header, new line detected. in :FileName" on line 35, referer: "##sitename###" do I need to remove the "\n" in the second part of the header varialbe? Link to comment https://forums.phpfreaks.com/topic/141449-header-may-not-contain-more-than-a-single-header-new-line-detected/ Share on other sites More sharing options...
trq Posted January 19, 2009 Share Posted January 19, 2009 You need to call header multiple times. header("Content-type: text/html; charset=utf-8"); header("Content-Transfer-Encoding: 8bit"); Link to comment https://forums.phpfreaks.com/topic/141449-header-may-not-contain-more-than-a-single-header-new-line-detected/#findComment-740383 Share on other sites More sharing options...
Mark Baker Posted January 19, 2009 Share Posted January 19, 2009 No, you need to output each header line individually: header("Content-type: text/html; charset=utf-8"); header("Content-Transfer-Encoding: 8bit"); and without the \r\n, let PHP do that for you Link to comment https://forums.phpfreaks.com/topic/141449-header-may-not-contain-more-than-a-single-header-new-line-detected/#findComment-740384 Share on other sites More sharing options...
denoteone Posted January 19, 2009 Author Share Posted January 19, 2009 I took out the second "\r\n" so now I have $headers = "Content-type: text/html; charset=utf-8\r\n"; $headers .= "Content-Transfer-Encoding: 8bit"; header($headers); Doesn't look as if I am getting the error any more. Does that sound right? Link to comment https://forums.phpfreaks.com/topic/141449-header-may-not-contain-more-than-a-single-header-new-line-detected/#findComment-740387 Share on other sites More sharing options...
Mark Baker Posted January 19, 2009 Share Posted January 19, 2009 Let me repeat what I said with added emphasis: No, you need to output each header line individually: header("Content-type: text/html; charset=utf-8"); header("Content-Transfer-Encoding: 8bit"); and without the \r\n, let PHP do that for you Link to comment https://forums.phpfreaks.com/topic/141449-header-may-not-contain-more-than-a-single-header-new-line-detected/#findComment-740407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.