Parsing vCard in php
Hi i want to parse vCard format to a array. User may upload vCard 2,1 or vCard 3.0 i should be able to parse it. I just want the email with names in the vCard in to a php array. i have tried vcardphp.sourceforge.net. <?php require("vcard.php"); $cards = parse_vcards(file('sample.txt')); print_r($cards); function parse_vcards($lines) { $cards = array(); $card = new VCard(); while ($card->parse($lines)) { $property = $card->getProperty('N'); if (!$property) { return ""; } $n = $property->getComponents(); $tmp = array(); if ($n[3]) $tmp[] = $n[3]; // Mr. if ($n[1]) $tmp[] = $n[1]; // John if ($n[
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.