コード例 #1
0
// $username is written to the config.php file which was entered on the
// index.php
$DatastoreUser = $Datastore->lookupUser($username);
// if the user is found then display data else give them a chance to verify
// authentication
if ($DatastoreUser) {
    // Istantiate ConstantContact Object and push in credentails for
    // authentication that would be retrieved form config.php
    $ConstantContact = new ConstantContact('oauth', $apiKey, $username, $consumerSecret);
    // Get all lists from account
    $Lists = $ConstantContact->getLists();
    // Get all verified email addresses
    $VerifiedEmailAddresses = $ConstantContact->getVerifiedAddresses();
    // parse states and countries
    $allStates = $ConstantContact->getStates();
    $allCountries = $ConstantContact->getCountries();
    // Check to see if this is a campaign that we are editing or if this is
    // adding a campaign
    if (!empty($_GET["campaignID"]) && empty($_GET["status"])) {
        // Return the campaign details by ID
        $CampaignResult = $ConstantContact->getCampaignByID($_GET["campaignID"]);
    }
    // If user is adding a new campaign, campaignName would be set to the POST
    if (isset($_POST["campaignName"])) {
        try {
            // Build Campaign Object
            $myCampaign = new Campaign();
            $myCampaign->name = $_POST["campaignName"];
            $myCampaign->subject = $_POST["subjectLine"];
            $myCampaign->fromName = $_POST["fromName"];
            if (isset($_POST["fromEmailAddress"])) {