previousContact_Vcard_Parse (Previous) (Next) How Data Is Returnednext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Introduction

Introduction – Build (create) and fetch vCard 2.1 and 3.0 text blocks.

Description

Here are some quick instructions for the impatient. :-)

  • Download and un-compress Contact_Vcard_Parse from the PEAR archive.

  • Include Contact_Vcard_Parse.php in your PHP script.

  • Instantiate a new Contact_Vcard_Parse object.

  • Use the fromFile() method to parse any file which may have one or more vCards in it; try the sample.vcf file for a start. Contact_Vcard_Parse should work with both 2.1 and 3.0 vCard files.

  • Use print_r() to view the resulting array of data from the parsed file.

  • Do what you want with the data, such as insert into a table.

Example code

<?php
    
// include the class file
    
require_once 'Contact_Vcard_Parse.php';

    
// instantiate a parser object
    
$parse = new Contact_Vcard_Parse();

    
// parse a vCard file and store the data
    // in $cardinfo
    
$cardinfo $parse->fromFile('sample.vcf');

    
// view the card info array
    
echo '<pre>';
    
print_r($cardinfo);
    echo 
'</pre>';

?>
previousContact_Vcard_Parse (Previous) (Next) How Data Is Returnednext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.