示例#1
0
<?php

require_once '../../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
Laposta::setHttpsDisableVerifyPeer(true);
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // get campaign content info, use campaign_id as argument
    // $result will contain een array with the response from the server
    $result = $campaign->get('pbrqulw2tc', 'content');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
// Create a new campaign, fill it, and send it.
// Left out most error-checking for brevity.
// new campaign object
$campaign = new Laposta_Campaign();
// first create new campaign
$result = $campaign->create(array('type' => 'regular', 'name' => 'Test API ' . date('d-m-Y H:i:s'), 'subject' => 'Google', 'from' => array('name' => 'Max de Vries', 'email' => '*****@*****.**'), 'reply_to' => '*****@*****.**', 'list_ids' => array('nnhnkrytua', 'srbhotdwob'), 'stats' => array('ga' => 'true')));
// get campaign_id from $result
$campaign_id = $result['campaign']['campaign_id'];
// import url
$campaign->update($campaign_id, array('import_url' => 'https://google.com', 'inline_css' => 'true'), 'content');
// stuur een testmail
$campaign->update($campaign_id, array('email' => '*****@*****.**'), 'action', 'testmail');
// en verstuur direct
$campaign->update($campaign_id, array(), 'action', 'send');
示例#3
0
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
// initialize campaign
$campaign = new Laposta_Campaign();
try {
    // get all campaign from account
    // $result will contain een array with the response from the server
    $result = $campaign->all();
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#4
0
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
// new campaign object
$campaign = new Laposta_Campaign();
try {
    // update campaign, use id as first argument
    // $result will contain een array with the response from the server
    $result = $campaign->update('pbrqulw2tc', array('subject' => 'This is the MODIFIED subject'));
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#5
0
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
// new campaign object
$campaign = new Laposta_Campaign();
try {
    // create new campaign, insert info as argument
    // $result will contain een array with the response from the server
    $result = $campaign->create(array('type' => 'regular', 'name' => 'Test API ' . date('d-m-Y H:i:s'), 'subject' => 'This is the subject', 'from' => array('name' => 'Max de Vries', 'email' => '*****@*****.**'), 'reply_to' => '*****@*****.**', 'list_ids' => array('nnhnkrytua', 'srbhotdwob'), 'stats' => array('ga' => 'true')));
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#6
0
<?php

require_once '../../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
Laposta::setHttpsDisableVerifyPeer(true);
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // update campaign content info, use campaign_id as argument
    // $result will contain een array with the response from the server
    $result = $campaign->update('pbrqulw2tc', array('import_url' => 'http://google.com'), 'content');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#7
0
<?php

require_once '../../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
Laposta::setHttpsDisableVerifyPeer(true);
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // instruct campaign to be sent right away, use campaign_id as argument
    $result = $campaign->update('re7qlwxjed', array('email' => '*****@*****.**'), 'action', 'testmail');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#8
0
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey("JdMtbsMq2jqJdQZD9AHC");
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // delete campaign, use campaign_id as argument
    // $result will contain een array with the response from the server
    $result = $campaign->delete("mvqedad500");
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#9
0
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
Laposta::setHttpsDisableVerifyPeer(true);
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // get campaign info, use campaign_id as argument
    // $result will contain een array with the response from the server
    $result = $campaign->get('lhnjt8osdc');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#10
0
<?php

require_once '../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
// Send existing campaign.
// new campaign object
$campaign = new Laposta_Campaign();
try {
    // and send
    $result = $campaign->update('1234567890', array(), 'action', 'send');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#11
0
<?php

require_once '../../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
Laposta::setHttpsDisableVerifyPeer(true);
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // instruct campaign to be sent at specified time, use campaign_id as argument
    $result = $campaign->update('94wb6pucra', array('delivery_requested' => '2016-05-20 12:00'), 'action', 'schedule');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}
示例#12
0
<?php

require_once '../../../lib/Laposta.php';
Laposta::setApiKey('JdMtbsMq2jqJdQZD9AHC');
Laposta::setHttpsDisableVerifyPeer(true);
// initialize campaign object
$campaign = new Laposta_Campaign();
try {
    // instruct campaign to be sent right away, use campaign_id as argument
    $result = $campaign->update('pbrqulw2tc', array(), 'action', 'send');
    print '<pre>';
    print_r($result);
    print '</pre>';
} catch (Exception $e) {
    // you can use the information in $e to react to the exception
    print '<pre>';
    print_r($e);
    print '</pre>';
}