Introduction

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

Описание

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.

Пример 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>';

?>
    Поддержать сайт на родительском проекте КГБ