Hi Mr/Mrs/Miss.

I am a new guys on Adwords API.
I am developing to getRelatedKeyword by Google Adwords API PHP 
But when i run code. I get value:

*[QuotaCheckError.INVALID_TOKEN_HEADER @ ; trigger:'binh.ro...@gmail.com
++USD']*

My Code:

   * $username = "binh.ro...@gmail.com";
    $password = "**********";
    $currencyCode = "USD";
    $developerToken = "$username++$currencyCode"; 
    try {

         $user = new AdWordsUser(null, $username, $password, 
$developerToken);
         $user->SetDefaultServer("https://adwords-sandbox.google.com";);
         $user->LogAll();
         $user->SetClientId('9840908587');

         $targetingIdeaService = 
$user->GetService('TargetingIdeaService','v201109');

         $keyword = new Keyword();
         $keyword->text = utf8_encode('gangnam style');

         $keyword->matchType = 'BROAD';

         $selector = new TargetingIdeaSelector();
         $selector->requestType = 'STATS';
         $selector->ideaType = 'KEYWORD';
  
         $selector->requestedAttributeTypes = 
array('CRITERION','GLOBAL_MONTHLY_SEARCHES', 'TARGETED_MONTHLY_SEARCHES',
              'AVERAGE_TARGETED_MONTHLY_SEARCHES', 
'COMPETITION','EXTRACTED_FROM_WEBPAGE'); 
  
         $paging = new Paging();
         $paging->startIndex = 0;
         $paging->numberResults = 10;
         $selector->paging = $paging;
  
         //v201109
  
        $relatedToKeywordSearchParameter = new 
RelatedToKeywordSearchParameter();
        $relatedToKeywordSearchParameter->keywords = array($keyword);

        $keywordMatchTypeSearchParameter = new 
KeywordMatchTypeSearchParameter();
        $keywordMatchTypeSearchParameter->keywordMatchTypes = 
array('BROAD');
   
        $locations = array();
        $location = new Location();
        $location->id = 2704; 
        $locations[] = $location;

        $locationTargetParameter = new LocationSearchParameter($locations); 
// Expects arra of locations

        $languages = array();
        $language = new Language();
        $language->id = 1040;
        $languages[] = $language;
  
        $languageTargetParameter = new LanguageSearchParameter($languages);
  //v201109
        $selector->searchParameters = 
array($relatedToKeywordSearchParameter,$keywordMatchTypeSearchParameter, 
$locationTargetParameter, $languageTargetParameter);

        $page = $targetingIdeaService->get($selector);

  // Display related keywords.
  
  if (isset($page->entries)) {
    foreach ($page->entries as $targetingIdea) {
      $data = MapUtils::GetMap($targetingIdea->data);
      $keyword = $data['CRITERION']->value;
      $averageMonthlySearches =
          isset($data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value)
          ? $data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value : 0;
      printf("Keyword with text '%s', match type '%s', and average
monthly "
          . "search volume '%s' was found.\n", $keyword->text,
          $keyword->matchType, $averageMonthlySearches);
    }
  } else {
    print "No related keywords were found.\n";
  }
} catch (Exception $e) {
  print $e->getMessage();
} 


Please help me to fix INVALID_TOKEN_HEADER

Thanks
*

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to