I have the following code that I use to generate a vCard (note that variables are declared earlier)
BEGIN:VCARD
VERSION:4.0
N:<?php echo $person["last"]; ?>;<?php echo $person["first"];?>;;;
FN:<?php echo $person["first"];?> <?php echo $person["last"]; ?>
ORG:<?php echo str_replace(",",'\,',Site::$NAME);?>
TITLE:CPA
TEL;TYPE=work,voice;VALUE=uri:tel:+1-<?php echo Site::$PHONE; ?>
TEL;TYPE=work,fax;VALUE=uri:tel:+1-<?php echo Site::$FAX; ?>
ADR;TYPE=work;LABEl="<?php echo Site::$ADDRESS . '
' . Site::$LINE_TWO . '
' . Site::$CITY . '\,' . Site::$STATE . " " . Site::$ZIP; ?>":;<?php echo Site::$LINE_TWO; ?>;<?php echo Site::$ADDRESS; ?>;<?php echo Site::$CITY; ?>;<?php echo Site::$STATE; ?>;<?php echo Site::$ZIP; ?>;United States of America
EMAIL:<?php echo $person["email"]; ?>
END:VCARD
But the problem is that I do not get new lines where I expect. Example output:
BEGIN:VCARD
VERSION:4.0
N:LAST;FIRST;;;
FN:FIRST LASTORG:ORGANIZATIONTITLE:TITLE
TEL;TYPE=work,voice;VALUE=uri:tel:PHONE_NUMBERTEL;TYPE=work,fax;VALUE=uri:PHONE_NUMBERADR;TYPE=work;LABEl="ADDRESS":;ADDRESS
EMAIL:EMAILEND:VCARD
For what ever reason some of the newlines are there, and some of them are never outputted. Is there a reason why this is happening, and is there a way to fix it?
Edit: I set the following headers prior to any output:
header("Content-Type: text/vcard");
header('Content-Disposition: attachment; filename="'. $person["first"] . " " . $person["last"] . ".vcf" . '"');