473,771 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP sending whitespace after headers?

Hello-
I'm working on a simple script that does something like:
header('Content-type: text/directory');
echo "BEGIN:VCARD\r\ n";

However, PHP appears to send some additional whitespace after the
headers are sent (after the 200 OK message). I noticed this behavior
also occurs when no custom headers are sent. The problem here is the
some vCard readers will fail if the file begins with whitespace, so how
can I disable this extra whitespace sending in PHP?

Thanks-
Harold

Aug 24 '06 #1
3 2070
*** Harold Martin escribió/wrote (24 Aug 2006 10:11:08 -0700):
header('Content-type: text/directory');
echo "BEGIN:VCARD\r\ n";

However, PHP appears to send some additional whitespace after the
headers are sent (after the 200 OK message). I noticed this behavior
also occurs when no custom headers are sent. The problem here is the
some vCard readers will fail if the file begins with whitespace, so how
can I disable this extra whitespace sending in PHP?
I can think of two possibilities:

1) There *are* whitespaces in the script, maybe before a <?php tag.
2) You are including a UTF-8 encoded file with UTF-BOM (PHP doesn't handle
BOMs properly)
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 24 '06 #2
Alvaro G. Vicario wrote:
*** Harold Martin escribió/wrote (24 Aug 2006 10:11:08 -0700):
header('Content-type: text/directory');
echo "BEGIN:VCARD\r\ n";

However, PHP appears to send some additional whitespace after the
headers are sent (after the 200 OK message). I noticed this behavior
also occurs when no custom headers are sent. The problem here is the
some vCard readers will fail if the file begins with whitespace, so how
can I disable this extra whitespace sending in PHP?

I can think of two possibilities:

1) There *are* whitespaces in the script, maybe before a <?php tag.
I double-checked, and this is definitely isn't the case.
2) You are including a UTF-8 encoded file with UTF-BOM (PHP doesn't handle
BOMs properly)
I'm pretty certain this is not the case, but how would I check?

Thanks-
Harold

Aug 24 '06 #3
*** Harold Martin escribió/wrote (24 Aug 2006 13:35:19 -0700):
>2) You are including a UTF-8 encoded file with UTF-BOM (PHP doesn't handle
BOMs properly)
I'm pretty certain this is not the case, but how would I check?
When you save a text file, the editor allows you to chose the encoding
(even Windows notepad). If it's ANSI, then it's not the case. If it's
UTF-8, then you must refer to your editor's configuration in order to know
if it's saving the BOM at the beginning of the file (or just save as ANSI
for troubleshooting purposes).

In any case, a small test case we can copy, paste and run, always helps.
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3221
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils import mimetypes import os,string
1
1809
by: >>Shailesh | last post by:
hi, my script(IMAP email client) is sending mail using imap_mail() function. imap_mail($To, $Subject, $Body, $headers); $headers = "From: <$From>\n"; $headers .= "X-Sender: <$U@$DOMAIN>\n";
4
3134
by: splicemix | last post by:
Hi all, I have recently set up a Drupal website. I am a beginner. My shared host server does not allow nobody@localhost to send emails, and prevents access to php.ini, so I spent some time getting a SMTP script running. While the Drupal feedback module and the new account creation works fine in terms of sending of mails, I am having some problems with the sending of password reminder emails. warning: Cannot modify header information -...
6
2750
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
1
2945
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux hosting plan. This time, it's PHP 5. Things are bound to not work as expected moving to a new...
0
1735
by: kencana | last post by:
Hi all, I got problem in sending email with image file attached. the problem is that i can't see the image, apart from that i also try to attach a txt file and it gave me no luck. the txt file in the mail attachment is empty. Tha following is my code, i hope somebody can help me out. $file="Globe.gif"; $fp = fopen($file,"r"); $fcontent = fread($fp ,filesize($file));
8
3808
by: Marty | last post by:
I'm having issues sending an email to an "@page.nextel.com" email address. I can send to any other email address fine, but when I try the page.nextel.com it gives me this error: Final-Recipient: XXXXXXX@page.nextel.com Diagnostic-Code: smtp; 554 message body contains illegal bare CR/LF characters. Action: failed Status: 5.0.0
3
1722
by: swethak | last post by:
Hi, i placed the php in windows server 2003 manually , set the path in Environmental variables , and place the php.ini file in windows. Now php works fine in my server sytem.When i write the mail sending code and run that program mail didn't sent. in my php.ini file consists the smtp=localhost smtp_port=25 sendmail_from=me@localhost.com In my smtp settings: Internet Information Services->righclick on default virtual smtp...
31
12707
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it is working for normal email servers, but NOT with gmail server, I am very puzzled still!!) Codes(item c below) It keeps complaining and logs and codes are below. a) apache access logs --------------------------------- 127.0.0.1 - - "GET...
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.