This Vcard class is very simple and will parser one Vcard file with one contact at time and it works for Vcard versions 2 and 3.

It will basically get a Vcard file (or text file with Vcard formating) and parse through it returning an array with the following:

Array
(
[name] => Array
(
[lastname] => Robot
[firstname] => Tired
[middlename] =>
)
[fullname] => Tired Robot
[business] => Tired Robot Blog
[title] => Blog Picture
[note] => Any notes associated with this contact
[phone] => 5615615561
[home] => 5615615562
[cell] => 5615615563
[fax] => 5615615564
[address] => Array
(
[0] => 1234 NW Street with no Name St
[1] => Deerfield Beach
[2] => FL
[3] => 33442
[4] => United States
)

[url] => www.tiredrobot.com
[email] => info@tirerobot.com
);

The result of the parse is returned as an array to make it easier to adapt to other entities (objects) that you might be working with in a very generic way.

The class is constructed in PHP5 format.

Click here to download

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]


Comments

  1. 1
    Michelle
    May 7th, 2008 at 11:49 pm

    Hello, I’m developing a script for vCard/.contact file registration to vBulletin forums and your parser was the best one I could find for what I needed. I need to ask for your permission to redistribute a modified version of this class (with the appropriate credits and link to here of course, in the file and in the release thread of my script) together with my script at vBulletin.org.

    Thanks in advance!

    -Lea

  2. 2
    Cris
    May 8th, 2008 at 8:08 am

    Hi Lea,

    Thanks for the interest. The class is open do use and modify as long as you referrer it back to the Tired Robot developers blog and, off course, give some credit to me.

    Welcome to the Tired Robot developers blog and hope you be back always.

    Cris

  3. 3
    Stewart
    October 20th, 2008 at 4:51 pm

    Sorry to be stupid, but how do I use this :S

  4. 4
    Cris
    October 21st, 2008 at 8:27 am

    The class is very simple. It will read a vcard file with a single vcard inside, parse to it and return all elements of the vcard inside an array. The results are returned into an array just because it is easier to parse and store the requested information in database or any other form that might want to.
    A practical example for using this class is having an user upload a vcard file of it’s own and with that information register into your site.
    Good luck.

Leave a Comment

You must be logged in to post a comment.

blank