[GLLUG] Vcard Tutorials?

Mike Szumlinski szumlins@msu.edu
Sat, 4 Jan 2003 23:19:09 -0500


I wrote this little script that writes a vcard for a user from a MySQL  
db.  You might be able to modify it to fit your needs.  It was pretty  
easy to write.

-Mike

<!---begin snippet-->

<?php

			//generate a vcard
			$vcardpath="/usr/local/www/data/britney/vcards/";
			$vcardname="$username.vcf";
			
			$newvcf= fopen("$vcardpath$vcardname","w+");
			
			fwrite($newvcf,"BEGIN:VCARD\n");
			fwrite($newvcf,"VERSION:3.0\n");
			fwrite($newvcf,"N:$lastname;$firstname;;;\n");
			fwrite($newvcf,"FN:$firstname $lastname\n");
			fwrite($newvcf,"EMAIL;type=HOME;type=pref:$email\n");
			
			if ($homephone){
			fwrite($newvcf,"TEL;type=HOME;type=pref:$homephone\n");
			}
			if ($workphone){
			fwrite($newvcf,"TEL;type=WORK;type=pref:$workphone\n");			
			}
			if ($mobilephone){
			fwrite($newvcf,"TEL;type=CELL;type=pref:$mobilephone\n");	
			}
			 
fwrite($newvcf,"ADR;type=HOME;type=pref:;;$address\\n$address2;$city;$st 
ate;$zip;\n");
			if ($aim){
			fwrite($newvcf,"X-AIM;type=HOME;type=pref:$aim\n");
			}
			if ($icq){
			fwrite($newvcf,"X-ICQ;type=HOME;type=pref:$icq\n");
			}
			if ($yahoo){
			fwrite($newvcf, "X-YAHOO;type=HOME;type=pref:$yahoo\n");
			}
			if ($msn){
			fwrite($newvcf, "X-MSN;type=HOME;type=pref:$msn\n");
			}			
			fwrite($newvcf,"END:VCARD\n");
			fclose($newvcf);
?>


On Saturday, January 4, 2003, at 07:14  PM, Mike Reed wrote:

>   There are a couple vcard scripts at hotscripts.com if you search
> for "vcard" in the php area.
>
>   You can find the vcard spec at
> http://www.imc.org/pdi/pdiproddev.html if you don't mind piecing
> it together...
>
>   Mike
>
>> I'm working on upgrading the contact list [phpWebSite] module that
>> we use for the GLLUG website.  I'd like to implement a feature
>> that allows users to download list entries as Vcard files (.vcf),
>> but I'm coming up short in finding a tutorial that explains the
>> syntax and options for creating Vcard files.  Has anyone come
>> across a tutorial like this..?
>>
>> --Brad Fears
>
>
>
> _______________________________________________
> linux-user mailing list
> linux-user@egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user
>