public function addSubscriberToList($listName, $filename, $filepath)
{
$file_name_with_full_path = realpath($filepath);

$post = array(

‘api_key’ => $this->config[‘apikey’],
‘listname’ => $listName,
‘file_contents’=>’@’.$file_name_with_full_path
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://api.elasticemail.com/lists/upload-contacts’);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result = curl_exec ($ch);
curl_close ($ch);

return $result;

}

Advertisements