i can provide some sample code in php:

<?php
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__) . '/aw_api_php_lib_2.7.0/src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.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();

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

  // Create seed keyword.
  $keyword = new Keyword();
  $keyword->text = 'internet explorer 9';
  $keyword->matchType = 'EXACT';

  // Create selector.
  $selector = new TargetingIdeaSelector();
  $selector->requestType = 'STATS';
  $selector->ideaType = 'KEYWORD';
  $selector->requestedAttributeTypes =
      array('CRITERION', 'KEYWORD_CATEGORY', 
'AVERAGE_TARGETED_MONTHLY_SEARCHES');

  // Set selector paging (required for targeting idea service).
  $paging = new Paging();
  $paging->startIndex = 0;
  $paging->numberResults = 10;
  $selector->paging = $paging;

  // Create related to keyword search parameter.
  $relatedToKeywordSearchParameter = new RelatedToKeywordSearchParameter();
  $relatedToKeywordSearchParameter->keywords = array($keyword);

  // Create keyword match type search parameter to ensure unique results.
  $keywordMatchTypeSearchParameter = new KeywordMatchTypeSearchParameter();
  $keywordMatchTypeSearchParameter->keywordMatchTypes = array('EXACT');

  $selector->searchParameters =
      array($relatedToKeywordSearchParameter, 
$keywordMatchTypeSearchParameter);

  // Get related keywords.
  $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;
  var_dump($data);
      $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' and categories '%s' was found.\n", 
$keyword->text,
          $keyword->matchType, $averageMonthlySearches, 
$data['KEYWORD_CATEGORY']->value);
    }
  } else {
    print "No related keywords were found.\n";
  }
} 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 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