Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-22-2006, 06:36 PM   #1
Registered: Aug 2003
Location: Connecticut
Distribution: Mandrake, Debian
Posts: 39

Rep: Reputation: 15
Question PHP Script for Importing vCards into a MySQL Database?

Does anybody have a PHP script for importing vCards into a MySQL database?

I'm using LAMP (Linux, Apache2, MySQL5, php4) on an old computer (running Debian) attached to my home network to provide a common contacts database my whole family can access using the browsers on their Windows boxes. (Think WebCalendar for names and addresses.) Our current contact managers (Palm and Outlook) export to CSV files, so I'll use those for the initial load into the family phone book, but I want to be able to use vCards to add new contacts to the database and update existing ones on a onesy-twosey basis.

Yes, I know vCards are XML files, and yes, I could read the vCard spec and figure out how to write a parser, but I figure this has got to be a problem somebody has already solved.

Old 01-20-2007, 03:54 PM   #2
Registered: Aug 2003
Location: Connecticut
Distribution: Mandrake, Debian
Posts: 39

Original Poster
Rep: Reputation: 15

I have found a solution to this problem.

There's a PHP class called Contact_Vcard_Parse.php that reads a Vcard file into an array called $cardinfo.

You use it as an include file in your PHP script. You can then access each piece of Vcard info by accessing the appropriate array element like this:

$last_name = ($cardinfo[0][N][0][value][0][0]);
$first_name = ($cardinfo[0][N][0][value][1][0]);

You can get Contact_Vcard_Parse.php here:

You can find more information by googling it, but the script itself contains comments showing how to use it.


mysql, php

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Title: PHP/MySQL Classifieds Script AddAsset1.php Script Insertion LXer Syndicated Linux News 0 07-02-2006 06:21 PM
PHP / MySQL importing *.dmp dolvmin Programming 3 02-25-2006 03:51 AM
Problem importing database back to MySql shubb Programming 3 11-29-2005 01:36 PM
MySQL: Importing a database from an XML file concoran General 0 09-08-2003 02:58 AM
Importing FreeBSD mysql database to RedHat Linux 7.3 RKris Linux - Software 6 05-06-2003 04:07 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:13 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration