[GLLUG] [OT]PHP Coding Question

Brad Fears brad@mtsdev.com
Tue, 8 Oct 2002 12:20:20 -0400 (EDT)


You should be able to write a header at the beginning of your output. 
Maybe just keep appending your output to one or two variables and print
them as a final function in your script.

<?php

function blah($output, $filename) {
header ('Content-Type: application/octet-stream');
header ("Content-Disposition: attachment; filename=$filename.vcf");
echo $output;
}

$filename = "damnthing";

$out = "Line1\n";
$out .= "Line2\n";
$out .= "Line3\n";

blah($out, $filename);

?>

Or something like that...

--Brad Fears

Mike Szumlinski said:
> Hmm...only problem is that the vcard is generated in the same script as
> a the validation schemes for the form and the database input.  Its just
> one huge script.  Any ideas how to write the header to the vCard using
> the fwrite function?
>
> -Mike
> On Saturday, October 5, 2002, at 02:29  AM, Benjamin Minshall wrote:
>
>> <?php
>>    header( "Content-type: text/x-vcard" );
>>    print "...vcard contents...\n";
>> ?>
>
>
> _______________________________________________
> linux-user mailing list
> linux-user@egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user