diff --git a/PHPwrapper/examples.php b/PHPwrapper/examples.php deleted file mode 100644 index 602c0f5..0000000 --- a/PHPwrapper/examples.php +++ /dev/null @@ -1,45 +0,0 @@ -ping(); -var_dump($ping); - -// Account -$details = $api->getAccountInfo(); -var_dump($details); - -// Campaigns -$campaigns = (array)$api->getCampaigns(); -$campaignIDs = array_keys($campaigns); -$campaign = $api->getCampaignByID($campaignIDs[0]); -var_dump($campaigns, $campaign); - -// Contacts -$contacts = (array)$api->getContacts(null); -$contactIDs = array_keys($contacts); -$setName = $api->setContactName($contactIDs[0], 'John Smith'); -$setCustoms = $api->setContactCustoms($contactIDs[0], array('title' => 'Mr', 'middle_name' => 'Fred')); -$customs = $api->getContactCustoms($contactIDs[0]); -$contact = $api->getContactByID($contactIDs[0]); -$geoIP = $api->getContactGeoIP($contactIDs[0]); -$opens = $api->getContactOpens($contactIDs[0]); -$clicks = $api->getContactClicks($contactIDs[0]); - -// Find the contact ID by using email ID and delete the contact -$contactEmail = (array)$api->getContactsByEmail('EMAIL_ID'); -$contactEmailID = array_keys($contactEmail); -$deleteResponse = $api->deleteContact($contactEmailID[0]); - - -var_dump($contacts, $setName, $setCustoms, $customs, $contact, $geoIP, $opens, $clicks); - -// Blacklists -$addBlacklist = $api->addAccountBlacklist('someone@domain.co.uk'); -$getBlacklist = $api->getAccountBlacklist(); -$delBlacklist = $api->deleteAccountBlacklist('someone@domain.co.uk'); -var_dump($addBlacklist, $getBlacklist, $delBlacklist); - -?> diff --git a/PHPwrapper/sendingNewsletter.php b/PHPwrapper/sendingNewsletter.php new file mode 100644 index 0000000..3657381 --- /dev/null +++ b/PHPwrapper/sendingNewsletter.php @@ -0,0 +1,112 @@ +ping(); +var_dump($ping); + +// Account +$details = $api->getAccountInfo(); +var_dump($details); + +// Campaigns +$campaigns = (array)$api->getCampaigns(); +$campaignIDs = array_keys($campaigns); +$campaign = $api->getCampaignByID($campaignIDs[0]); +var_dump($campaigns, $campaign); + +// Contacts +$contacts = (array)$api->getContacts(null); +$contactIDs = array_keys($contacts); +$setName = $api->setContactName($contactIDs[0], 'John Smith'); +$setCustoms = $api->setContactCustoms($contactIDs[0], array('title' => 'Mr', 'middle_name' => 'Fred')); +$customs = $api->getContactCustoms($contactIDs[0]); +$contact = $api->getContactByID($contactIDs[0]); +$geoIP = $api->getContactGeoIP($contactIDs[0]); +$opens = $api->getContactOpens($contactIDs[0]); +$clicks = $api->getContactClicks($contactIDs[0]); + +// Find the contact ID by using email ID and delete the contact +$contactEmail = (array)$api->getContactsByEmail('EMAIL_ID'); +$contactEmailID = array_keys($contactEmail); +$deleteResponse = $api->deleteContact($contactEmailID[0]); + + + +var_dump($contacts, $setName, $setCustoms, $customs, $contact, $geoIP, $opens, $clicks); + +// Blacklists +$addBlacklist = $api->addAccountBlacklist('someone@domain.co.uk'); +$getBlacklist = $api->getAccountBlacklist(); +$delBlacklist = $api->deleteAccountBlacklist('someone@domain.co.uk'); +var_dump($addBlacklist, $getBlacklist, $delBlacklist); + +?> + + + +get_campaigns( + $api_key, + array ( + # find by name literally + 'name' => array ( 'EQUALS' => '' ) + ) +); + +# uncomment following line to preview Response +print_r($campaigns); + +# because there can be only one campaign of this name +# first key is the CAMPAIGN_ID required by next method +# (this ID is constant and should be cached for future use) +$CAMPAIGN_ID = array_pop(array_keys($campaigns)); + +$contact_id = array('p3WW','PEU'); // Find the contact ID by using email ID and form as array like this. + +$body = "Newsletter message. we can send any HTML"; + +# Sending Newsletter to the campaign +$result = $client->send_newsletter( + $api_key, + array ( + + + "campaign" => $CAMPAIGN_ID, + "from_field" => "", // To find it . Use this $accountDetails = $api->getAccountFromFields(); + "reply_to_field" => "", // To find it . Use this $accountDetails = $api->getAccountFromFields(); + "subject" => "Subject of the Newsletter", + "name" =>"Any Name", + "contacts" => $contact_id, + + 'contents' => array( +'html' => $body +) +) + +); + + + + +?>