PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Karol Janyst  >  Contacts importer  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Contacts importer
Import contacts from Web mail accounts
Author: By
Last change: Comments correct
Date: 6 years ago
Size: 1,911 bytes


Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="pragma" content="no-cache"/>
// include class file
// creating new Contacts Importer object
$import = new ContactsImporter;

// set temp directory (necessary for storage Windows Live config)
$import->TempDir = '/tmp/';
// set URL to which script will return after authorization (GMail and Windows Live)
$import->returnURL = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];

// Windows Live requires policy file, it could be anything
$import->WLLPolicy = 'http://'.$_SERVER['SERVER_NAME'].'policy.php';
// set API key for created application on Windows Live
$import->WLLAPIid = '<insert your API key here>';
// set your secret phrase for Windows Live application
$import->WLLSecret = '<insert your secret phrase here>';

// set API key for Yahoo application
$import->YahooAPIid = '<insert your API key here>';
// set secret phrase for Yahoo application
$import->YahooSecret = '<insert your secret phrase here>';
//prints out authorization links for all 3 services
echo '<a href="'.$import->getGMailLink().'">GMail</a>';
'<a href="'.$import->getWLLLink().'">Hotmail</a>';
'<a href="'.$import->getYahooLink().'">Yahoo</a>';

// fetches contacts from authorized mail service
$contacts = $import->getContacts();

// prints out all fetched contacts
  // data structure is:
  // $contact->name - for name of the contact
  // $contact->email - for email address
if (!empty($contacts)) {