I was Googling for this and saw a couple people needed it, this is just a small library wrapper for the OpenInviter.com tool that will return contacts as an array for you to work with.
<?php
/* tky@tmo.blackberry.net inviter.php Fri May 22 04:00:19 GMT 2009 */
class importer
{
var $ci;
var $imported;
public function __construct()
{
$this->ci=&get;_instance();
}
public function grab_contacts($plugin,$username,$password)
{
require_once($this->ci->config->item('absolute_url').'include/openinviter/openinviter.php');
$oi = new OpenInviter();
$oi->startPlugin($plugin);
$oi->login($username,$password);
$array = $oi->getMyContacts();
if(is_array($array) && count($array)>=1)
{
$this->imported = $array;
$this->_store_invited();
return($this->imported);
}else{
return;
}
}
private function _store_invited()
{
foreach($this->imported as $mail=>$name)
{
$a = array( 'user_id' => ospc_user_id(),
'name' => $name,
'email_address' => $mail,
'status' => 0,
'time_imported' => time() );
$this->ci->db->insert('ospc_imported',$a);
unset($a);
}
}
}
?>
