OpenInviter is an open source free import contact script to get email contacts of the particular user from almost all major email service providers like aol, gmail, yahoo mail, msn hotmail etc. The script is written in PHP and can be downloaded from here.
The pre-requirements are common but important. The server will need to have PHP5 installed with DOMDocument support and either cURL or WGET. For more information regarding Curl and enabling it for your purpose you can check out this tip or the manual page.
After enabling curl, the couple of changes are required for using openiviter at your project or need. We first need to remove postinstall.php present in the downloaded openinviter directory. The next is making changes on the config.php. If you open config.php, you may see an array named “openinviter_settings” having some information regarding the person who has downloaded openinviter from the site. For our concern the important indices are :
We need to make changes ( if required) in these three indices because the default cookie_path is set to ‘/tmp’. The other one if a very large number of contacts is getting imported. For that case we might need to change time limit in the php.ini file. Or simply write the following line in your particular function where the instance of the openinviter is created : set_time_limit(10000); // set_time_limit(0); ( if execution time is not known or very large).
Now it is well set for our use, we just need to include the particular openinviter class and start working with its instance.
For creating the instance, we can use the following code:
require_once( 'openinviter/openinviter.php');//This may vary. e.g. we can first
get the current
//working directory path and then include the
//openinviter class as it creates problem
// sometimes logging error messages.
// For that case we can use php function getcwd(),
// $current_directory = getcwd();
// require_once( $current_directory.'\your_path\openinviter\openinviter.php');
$inviter=new OpenInviter(); // creating the instance $oi_services=$inviter->getPlugins(); // calling different functions of openinviter class
The rest of the code in accordance with your requirements. They have provided some good easy to learn and use examples in the download package ( /openiviter/example.php, /openinviter/more_examples ).