} if (ValidVar($_GET['NoComp'])) { $NoComp = $_GP['NoComp']; } if (ValidVar($_GET['CpId'])) { $CpId = $_GP['CpId']; } $CpId = $CompId; if (!ValidId($CpId)) { $nsProduct->Redir("default"); } ///////////////////////////////////////////// ///////// call any process functions if (!$nsUser->DEMO) { if (ValidId($EditId) && isset($EditArr) && is_array($EditArr)) { UpdateCampaign($EditId, $EditArr); } if (isset($EditId) && $EditId == "new" && isset($EditArr) && is_array($EditArr)) { CreateCampaign($EditArr, $ParentId); } if (ValidId($DeleteId)) { DeleteCampaign($CpId, $DeleteId); } if (ValidId($MoveId) && ValidId($MoveTo)) { MoveCampaign($MoveId, $MoveTo); } if (ValidId($SortId) && isset($SortTo) && ValidId($ParentId)) { SortTable(PFX . "_tracker_campaign", false, $SortId, $SortTo, "PARENT_ID={$ParentId}"); } } /////////////////////////////////////////////
// Create campaign using an existing ID. $campaign = new Campaign(); $campaign->id = $campaignId; $campaign->status = $state; // Create operation. $operation = new CampaignOperation(); $operation->operand = $campaign; $operation->operator = 'SET'; $operations = array($operation); // Make the mutate request. $result = $campaignService->mutate($operations); // Display result. $campaign = $result->value[0]; ?> <script> window.location="adwords_dashboard.php"; </script> <?php } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. $user->LogAll(); // Run the example. UpdateCampaign($user, $campaignId, $state); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }
$campaignId = $id; function UpdateCampaign(AdWordsUser $user, $campaignId) { // Get the service, which loads the required classes. $campaignService = $user->GetService('CampaignService', $adwords_version); // Create campaign using an existing ID. $campaign = new Campaign(); $campaign->id = $campaignId; $campaign->status = 'PAUSED'; // Create operation. $operation = new CampaignOperation(); $operation->operand = $campaign; $operation->operator = 'SET'; $operations = array($operation); // Make the mutate request. $result = $campaignService->mutate($operations); // Display result. $campaign = $result->value[0]; echo "Campaign with ID '%s' was paused.\n", $campaign->id; } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. $user->LogAll(); // Run the example. UpdateCampaign($user, $campaignId); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }