$myCampaign->lists = $_POST["lists"]; } // If you are editing the page it will need to do a PUT to a // different URI so we need to build the ID and LINK to the campaign // and try to udpate if (isset($_GET["status"]) == "edit") { // sets the ID of the campaign based on the username and // campaignID $myCampaign->id = "http://api.constantcontact.com/ws/customers/" . $username . "/campaigns/" . $_GET["campaignID"]; // sets the campaigns link and replaces the // http://api.constantcontact.com as it already exists in the // wrapper $myCampaign->link = str_replace("http://api.constantcontact.com", "", $myCampaign->id); // Stores results of our PUT, if false malformed XML was passed // in or to incorrect URI $TestingUpdate = $ConstantContact->updateCampaign($myCampaign); if ($TestingUpdate != false) { // Put was a success $CampaignResult = $ConstantContact->getCampaignByID($_GET["campaignID"]); } else { // Stores all the information from the get back to the form // fields so you can modify your data $CampaignResult = $ConstantContact->getCampaignByID($_GET["campaignID"]); $UpdateError = TRUE; } } else { // Adds your new campaign to your Constant Contact Account $CampaignResult = $ConstantContact->addCampaign($myCampaign, $fromAddress); // $CampaignResult will now hold the referenced campaign object $lastCampaigns = $ConstantContact->getCampaigns(); if (isset($CampaignResult->status)) {