user2083524
user2083524

Reputation: 121

Generating a VCARD with php QRcodes

i try to generate VCARDS with http://phpqrcode.sourceforge.net/ with the following code

<?php
include('myclasses/phpqrcode/qrlib.php');
QRcode::png("BEGIN:VCARD VERSION:3.0 N:Mustermann;Max FN:Max Mustermann ORG:Firma",
"myclasses/phpqrcode/test2.png", "L", 4, 4);
echo '<img src="myclasses/phpqrcode/test2.png" />'; 
php?>

Has anyone an idea whats wrong ? the scanner gets an empty vcard !

thanx

Upvotes: 1

Views: 4870

Answers (1)

Terence Eden
Terence Eden

Reputation: 14334

A standard vCard looks like this: http://en.wikipedia.org/wiki/VCard#Example_vCard_files

BEGIN:VCARD
VERSION:2.1
N:Gump;Forrest
TEL;WORK;VOICE:(111) 555-1212
END:VCARD

Notice that there is a new line after every field.

Your card says

BEGIN:VCARD VERSION:3.0 N:Mustermann;Max FN:Max Mustermann ORG:Firma

There are no newlines so the vCard scanner is getting confused.

You need to explicitly put in newlines to make it work. For example:

BEGIN:VCARD\nVERSION:3.0\nN:Mustermann;Max\nFN:Max Mustermann\nORG:Firma

That should make your card work.

Upvotes: 3

Related Questions