Hi Eric!
I have a similar problem.
Now I'm able to get the search volume for one single keyword with the local
code. But I have a lot of keywords and so I will generate mutiple requests.
My question: is it possible to make a request for a list of keywords?
Maybe you have an advise for me. I use the GetRelatedKeywords.php from the
example-folder.
Here is my sourcecode with some modifications:
<?php
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once 'src/Google/Api/Ads/Common/Util/MapUtils.php';
$user = new AdWordsUser();
function getSearchVolume($phrase, $type, $countryID, $langID) {
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';
global $user;
try {
// Get AdWordsUser from credentials in "../auth.ini"
// relative to the AdWordsUser.php file's directory.
// Log SOAP XML request and response.
#$user->LogDefaults();
// Get the TargetingIdeaService.
$targetingIdeaService = $user->GetTargetingIdeaService('v201101');
// Set country-code
$country = new CountryTarget();
$country->countryCode = $countryID;
$countryTargetSearchParameter = new CountryTargetSearchParameter();
$countryTargetSearchParameter->countryTargets = $country;
// Set language-code
$language = new languageTarget();
$language->languageCode = $langID;
$languageTargetSearchParameter = new
LanguageTargetSearchParameter();
$languageTargetSearchParameter->languageTargets = $language;
// Create seed keyword.
$keyword = new Keyword();
$keyword->text = $phrase;
$keyword->matchType = $type;
// Create selector.
$selector = new TargetingIdeaSelector();
$selector->requestType = 'STATS';
$selector->ideaType = 'KEYWORD';
$selector->requestedAttributeTypes = array(
'CRITERION',
'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($type);
// set selector
$selector->searchParameters = array(
$relatedToKeywordSearchParameter,
$keywordMatchTypeSearchParameter,
$countryTargetSearchParameter,
$languageTargetSearchParameter
);
// Get related keywords.
$page = $targetingIdeaService->get($selector);
return $page->entries[0]->data[1]->value->value;
} catch (Exception $e) {
print $e->getMessage();
}
}
echo getSearchVolume("Guido Westerwelle", "EXACT", "DE", "de");
?>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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