<?php

/**
 * This file contains examples for using the MailWizzApi PHP-SDK.
 *
 * @author Serban George Cristian <*****@*****.**>
 * @link http://www.mailwizz.com/
 * @copyright 2013 http://www.mailwizz.com/
 */
// require the setup which has registered the autoloader
require_once dirname(__FILE__) . '/setup.php';
// CREATE THE ENDPOINT
$endpoint = new MailWizzApi_Endpoint_Campaigns();
/*===================================================================================*/
// GET ALL ITEMS
$response = $endpoint->getCampaigns($pageNumber = 1, $perPage = 10);
// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// GET ONE ITEM
$response = $endpoint->getCampaign('CAMPAIGN-UNIQUE-ID');
// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// CREATE CAMPAIGN
$response = $endpoint->create(array('name' => 'My API Campaign', 'from_name' => 'John Doe', 'subject' => 'Hey, i am testing the campaigns via API', 'reply_to' => '*****@*****.**', 'send_at' => date('Y-m-d H:i:s', strtotime('+1 hour')), 'list_uid' => 'LIST-UNIQUE-ID', 'segment_uid' => 'SEGMENT-UNIQUE-ID', 'template' => array('content' => file_get_contents(dirname(__FILE__) . '/template-example.html'), 'inline_css' => 'no')));
// DISPLAY RESPONSE
<?php

/**
 * This file contains examples for using the SendReach PHP-SDK.
 */
// require the setup which has registered the autoloader
require_once dirname(__FILE__) . '/setup.php';
// CREATE THE ENDPOINT
$endpoint = new MailWizzApi_Endpoint_Campaigns();
/*===================================================================================*/
// GET ALL ITEMS
$response = $endpoint->getCampaigns($pageNumber = 1, $perPage = 10);
// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// GET ONE ITEM
$response = $endpoint->getCampaign('CAMPAIGN-UNIQUE-ID');
// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// CREATE CAMPAIGN
$response = $endpoint->create(array('name' => 'My API Campaign', 'type' => 'regular', 'from_name' => 'John Doe', 'from_email' => '*****@*****.**', 'subject' => 'Hey, i am testing the campaigns via API', 'reply_to' => '*****@*****.**', 'send_at' => date('Y-m-d H:i:s', strtotime('+10 hours')), 'list_uid' => 'LIST-UNIQUE-ID', 'segment_uid' => 'SEGMENT-UNIQUE-ID', 'options' => array('url_tracking' => 'no', 'json_feed' => 'no', 'xml_feed' => 'no', 'plain_text_email' => 'yes', 'email_stats' => null), 'template' => array('content' => file_get_contents(dirname(__FILE__) . '/template-example.html'), 'inline_css' => 'no', 'plain_text' => null, 'auto_plain_text' => 'yes')));
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/