1. Go to this page and download the library: Download jiririedl/php-sendy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jiririedl / php-sendy example snippets
$phpSendyPath = ''; // here you can fill something like 'vendor/SendyPHP'
$sendy = new \SendyPHP\Sendy('http://mysendyinstalation.mydomain','myAPIKey');
try{
$sendy = new \SendyPHP\Sendy('http://mysendyinstalation.mydomain','myAPIKey');
$statusMessage = '';
$subscribersCount = $sendy->getActiveSubscriberCount('myHashedListID',$statusMessage);
if($subscribersCount!==false)
echo "In this list is $subscribersCount active subscribers";
else
echo "Ops! Sendy API responds a problem with getting active subscribers count - Sendy PHP message :".$statusMessage;
}catch (\SendyPHP\Exception $e)
{
echo "Ops! An exception raised: ".$e;
}
try{
$sender = new \SendyPHP\Model\Sender('From name','[email protected]','[email protected]');
$emailBody = new \SendyPHP\Model\EmailBody('<h1>HTML body of my newsletter</h1>', 'Plaintext body of my newsletter');
$campaign = new \SendyPHP\Model\Campaign($sender,'My first great newsletter!',$emailBody);
$brandID = 1; // here fill your brand ID
$sendy = new \SendyPHP\Sendy('http://mysendyinstalation.mydomain','myAPIKey');
$statusMessage = '';
$status = $sendy->createCampaign($brandID,$campaign,$statusMessage);
if($status)
{
echo "Campaign successfully created";
}
else
echo "Ops! Sendy API responds a problem with creating campaign - Sendy PHP message :".$statusMessage;
}catch (\SendyPHP\Exception $e)
{
echo "Ops! An exception raised: ".$e;
}
try{
$sender = new \SendyPHP\Model\Sender('From name','[email protected]','[email protected]');
$emailBody = new \SendyPHP\Model\EmailBody('<h1>HTML body of my newsletter</h1>', 'Plaintext body of my newsletter');
$campaign = new \SendyPHP\Model\Campaign($sender,'My first great newsletter!',$emailBody);
$listIDs = array(1); // here fill your list IDs
$sendy = new \SendyPHP\Sendy('http://mysendyinstalation.mydomain','myAPIKey');
$statusMessage = '';
$status = $sendy->sendCampaign($listIDs,$campaign,$statusMessage);
if($status)
{
echo "Campaign successfully created and now sending";
}
else
echo "Ops! Sendy API responds a problem with creating and sending campaign - Sendy PHP message :".$statusMessage;
}catch (\SendyPHP\Exception $e)
{
echo "Ops! An exception raised: ".$e;
}
void setCurlOption($option, $value)
void clearCurlOptions()
void setURL($URL)
void setApiKey($apiKey)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.