My error:  [ApiUsageError.INVALID_CLIENT_EMAIL @ selector;
trigger:'[email protected]']


auth settings.ini

email = "[email protected]"
password = "********************"
userAgent = "ISPG"
applicationToken = "ignored"
developerToken = "[email protected]++EUR"

; Uncomment to make requests against a client account.
 ;clientId = ""


; Uncomment the following to use an existing AuthToken.
;authToken = "INSERT_AUTH_TOKEN_HERE"

; Uncomment the following to use existing OAuth information.
; [OAUTH]
; oauth_consumer_key = "INSERT_OAUTH_CONSUMER_KEY_HERE"
; oauth_consumer_secret = "INSERT_OAUTH_CONSUMER_SECRET_HERE"
; oauth_token = "INSERT_OAUTH_TOKEN_HERE"
; oauth_token_secret = "INSERT_OAUTH_TOKEN_SECRET_HERE"
----------------------------------------------------------------------------------------------------------------------
SETTINGS.ini


[LOGGING]
; Log directory is either an absolute path, or relative path to the
; AdWordsUser.php file.
PATH_RELATIVE = "1"
LIB_LOG_DIR_PATH = "../../../../../../logs"

[SERVER]
DEFAULT_VERSION = "v201109"

; Change to https://adwords-sandbox.google.com to work in the sandbox
; environment.
DEFAULT_SERVER = "https://adwords-sandbox.google.com";

[SOAP]
; Enable/disable gzip compression on SOAP requests and responses.
COMPRESSION = 1

; The level of gzip compression to use, from 1 to 9. The higher the
level the
; greater the compression and time needed to perform the compression.
The
; recommended and default value is 1.
COMPRESSION_LEVEL = 1

; The type of WSDL caching to use. The possible values are 0 (none), 1
(disk),
; 2 (memory), or 3 (disk and memory). The default value is 0.
WSDL_CACHE = 0

; Other WSDL caching settings can be set in php.ini. See the following
page for
; the complete list: http://www.php.net/manual/en/soap.configuration.php

[PROXY]
; Proxy settings to be used by HTTP (and therefore SOAP) requests.
; HOST = "<HOST>"
; PORT = "<PORT>"
; USER = "<USER NAME>"
; PASSWORD = "<PASSWORD>"

[AUTH]
; The server to use when making ClientLogin or OAuth requests. This
normally
; doesn't need to be changed from the default value "https://
www.google.com".
; AUTH_SERVER = "<SERVER>"

; The OAuthHandler class to use for OAuth flow.
; OAUTH_HANDLER_CLASS = "<CLASS NAME>"

[SSL]
; Enable/disable peer verification of SSL certificates. If enabled,
specify
; either CA_PATH or CA_FILE.
VERIFY_PEER = 0

; The certificate authority directory to search in when performing
peer
; validation. For example: /etc/ssl/certs
; CA_PATH = "<PATH TO CERTIFICATE AUTHORITY DIRECTORY>"

; The certificate authority file to use when performing peer
validation.
; CA_FILE = "<PATH TO CERTIFICATE AUTHORITY FILE>"
----------------------------------------------------------------------------------------------------------------
GETClientCustomerId.php Code


?php
/**
 * This example illustrates how to find a client customer ID for a
client email.
 * We recommend to use this script as a one off to convert your
identifiers to
 * IDs and store them for future use.
 *
 * Tags: InfoService.get
 *
 * PHP version 5
 *
 * Copyright 2011, Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @package    GoogleApiAdsAdWords
 * @subpackage v201109
 * @category   WebServices
 * @copyright  2011, Google Inc. All Rights Reserved.
 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache
License,
 *             Version 2.0
 * @author     Eric Koleda <[email protected]>
 */

error_reporting(E_STRICT | E_ALL);

// You can set the include path to src directory or reference
// AdWordsUser.php directly via require_once.
// $path = '/path/to/aw_api_php_lib/src';
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php';

try {
  // Get AdWordsUser from credentials in "../auth.ini"
  // relative to the AdWordsUser.php file's directory.
  $user = new AdWordsUser();

  // Log SOAP XML request and response.
  $user->LogDefaults();


  // Ensure the clientCustomerId is not set, so that requests are made
to the
  // MCC.
  $user->SetClientId(NULL);

  // Get the InfoService.
  $infoService = $user->GetService('InfoService', 'v201109');

  $clientEmail = '[email protected]';

  // Create selector.
  $selector = new InfoSelector();
  $selector->clientEmails = array($clientEmail);
  $selector->includeSubAccounts = TRUE;
  $selector->apiUsageType = 'UNIT_COUNT_FOR_CLIENTS';
  // The date used doesn't matter, so use today.
  date_default_timezone_set('UTC');
  $start_date = "2011-03-01";
$end_date = "2011-03-31";

  $selector->dateRange = new DateRange(date('Ymd'), date('Ymd'));

  // Get the information for the client email address.
  $info = $infoService->get($selector);
 print_r($info);
  foreach ($info->apiUsageRecords as $record) {
    printf("Found record with client email '%s' and customer ID '%s'.
\n",
        $record->clientEmail, $record->clientCustomerId);
  }
} catch (Exception $e) {
  print $e->getMessage();
}
?>

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to