Class AdWordAccountService

Description

AdWords Lib Account Service Class

Use this class to work with Google AdWords Account Service. AccountService provides operations for accessing, modifying, and creating Accounts

Located in /services/AdWordAccountService.inc

AdWordService
   |
   --AdWordAccountService
Method Summary
 AdWordAccountService AdWordAccountService (string $soapToolkit)
 object|false getAccountInfo ([string $clientEmail = ''])
 array|false getClientAccounts ([ $clientEmail = ''])
 bool setLoginInfo (string $login, string $newPassword, [string $clientEmail = ''])
 bool updateAccountInfo (object AdWordAccountInfo $accountInfo, [string $clientEmail = ''])
Methods

AdWordAccountService Constructor. It takes one parameter - name of a supported by AdWords Lib SOAP toolkit

Example:

  1.  <?php
  2.  ?>
Please use defined constants for supported by AdWords Lib toolkit names

AdWordAccountService AdWordAccountService (string $soapToolkit)
  • string $soapToolkit: name of a supported by AdWords Lib SOAP Toolkit

Return the AdWords account specified by the client account header.

Example:

  1.  <?php
  2.  $accountService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  $response $accountService->getAccountInfo();
  4.  if ($response === false// if an error appears
  5.          $errr $classKW->getLastError()//get error object
  6.          echo $errr->toString()//output error
  7.          exit();
  8.  }
  9.  ?>

object|false getAccountInfo ([string $clientEmail = ''])
  • string $clientEmail: provide the clientEmail when you want to use a client's account rather than your own account

Gets the primary email address for each account managed by the effective user.

If the effective user user has no client accounts, an empty array is returned. The effective user is: * the user specified in the clientEmail header of the request if that header is provided * the user specified in the email header if the clientEmail header is not provided For more information about the clientEmail header, see the section Request Headers in the Introduction. In other words, you can use the getClientAccounts request to find the primary email addresses for your own clients, or for your client's clients. If an account has more than one email associated with it, getClientAccounts gets only the primary email for the account.

Example:

  1.  <?php
  2.  $accountService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  $response $accountService->getClientAccounts();
  4.  if ($response === false// if an error appears
  5.          $errr $accountService->getLastError()//get error object
  6.          echo $errr->toString()//output error
  7.          exit();
  8.  }
  9.  //$response is an array of strings
  10.  ?>

array|false getClientAccounts ([ $clientEmail = ''])
  • $clientEmail

Set the login information for the current user.

Example:

  1.  <?php
  2.  $accountService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  
  4.  $response $accountService->setLoginInfo('newemail@google.com''password');
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  ?>

bool setLoginInfo (string $login, string $newPassword, [string $clientEmail = ''])
  • string $login: the login email of the account
  • string $newPassword: the password for the account
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Updates the database to reflect the changes in the account object.

Example:

  1.  <?php
  2.  $accountService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  
  4.  $account new AdWordAccountInfo;
  5.  $account->set('descriptiveName''Renamed Account');
  6.  $account->set('languagePreference''en');
  7.  
  8.  $response $accountService->updateAccountInfo($account);
  9.  if ($response === false// if an error appears
  10.          $errr $classKW->getLastError()//get error object
  11.          echo $errr->toString()//output error
  12.          exit();
  13.  }
  14.  ?>

bool updateAccountInfo (object AdWordAccountInfo $accountInfo, [string $clientEmail = ''])
  • object AdWordAccountInfo $accountInfo: the account info object to be updated
  • string $clientEmail: provide the clientEmail when you want to use a client's account rather than your own account

Inherited Methods

Inherited From AdWordService

 AdWordService::AdWordService()
 AdWordService::callService()
 AdWordService::getAccount()
 AdWordService::getClientCustomerId()
 AdWordService::getClientEmail()
 AdWordService::getLastError()
 AdWordService::getResponseHeaders()
 AdWordService::setAccount()
 AdWordService::setClientCustomerId()
 AdWordService::setClientEmail()

Documentation generated on Mon, 10 Sep 2007 15:07:11 +0300 by phpDocumentor 1.3.2