1
I want to create a vCard file in PHP. Insert values that come from an Sqlite database, and download the file.
1
I want to create a vCard file in PHP. Insert values that come from an Sqlite database, and download the file.
1
You have two different questions:
The first problem is simple, just use the PDO or the Sqlite. Just connect, run the query and read the resource. This is basic and changes little thing from one DBMS to another.
For the second problem you have to study the specification vCard format, which is as difficult as any RFC, creating vCard manually from a more readable example or outsource.
There are several classes ready to create vCards. Some more complete than others and others more able to handle the basics. A quick Google search and you would find, for example, that article with an easy-to-use class:
require 'vCard.class.php'; // Altere se necessário
$vCard = new vcard;
$vCard -> data['first_name'] = 'Bruno Augusto';
$vCard -> download();
I filled out only my name because I’m lazy. p
The method download as the name suggests will force the download of the VCF file ready. Maybe you need a VCF reader. Here Windows 7 recognized automatically:
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
You have a Parse error in your code ;)
– Zuul
The Sublime fills the patience by closing the brackets of my arrays automatically. Thank you!
– Bruno Augusto
Always at the ready and +1 for the reply.
– Zuul