예제 #1
0
    $adGroupAd = new AdGroupAd();
    $adGroupAd->adGroupId = $adGroupId;
    $adGroupAd->ad = $ad;
    // Update the status.
    $adGroupAd->status = 'PAUSED';
    // Create operation.
    $operation = new AdGroupAdOperation();
    $operation->operand = $adGroupAd;
    $operation->operator = 'SET';
    $operations = array($operation);
    // Make the mutate request.
    $result = $adGroupAdService->mutate($operations);
    // Display result.
    $adGroupAd = $result->value[0];
    printf("Ad of type '%s' with id '%s' has updated status '%s'.\n", $adGroupAd->ad->AdType, $adGroupAd->ad->id, $adGroupAd->status);
}
// Don't run the example if the file is being included.
if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
    return;
}
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.
    PauseAdExample($user, $adGroupId, $adId);
} catch (Exception $e) {
    printf("An error has occurred: %s\n", $e->getMessage());
}
 public function testPauseAdExample()
 {
     $adId = $this->testUtils->CreateTextAd($this->adGroupId);
     PauseAdExample($this->user, $this->adGroupId, $adId);
 }