Hi Josh,
I am able to access the api with my test account.
I am trying to get avg monthly search value for the given keyword.But its
not giving same result as keyword planner tool.
this is my code
require_once dirname(dirname(__FILE__)) . '/init.php';
$user = new AdWordsUser();
// Log every SOAP XML request and response.
$user->LogAll();
$adwords_version = ADWORDS_VERSION;
$keyword = "lease-accounting";
$values = GetTargetingIdea($user, $adwords_version, $keyword);
print_r($values);
function GetTargetingIdea(AdwordsUser $user, $adwords_version, $keyword)
{
// Load the service, so that the required classes are available.
$targetingIdeaService =
$user->GetTargetingIdeaService($adwords_version);
$languageParameter = new LanguageSearchParameter();
$english = new Language();
$english->id = 1000;
$languageParameter->languages = array($english);
// Create selector.
$selector = new TargetingIdeaSelector();
$selector->requestType = "STATS";
$selector->ideaType = 'KEYWORD';
$selector->requestedAttributeTypes =
array('KEYWORD_TEXT','SEARCH_VOLUME');
$locationTargetParameter = new LocationSearchParameter();
$location = new location();
$location->id = 2840;
$locationTargetParameter->locations = $location;
$relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();
$relatedToQuerySearchParameter->queries = array($keyword);
$selector->searchParameters[] = $relatedToQuerySearchParameter;
//$selector->searchParameters[] = $languageParameter;
//$selector->searchParameters[] = $locationTargetParameter;
// Create paging controls.
$selector->paging = new Paging(0,
AdWordsConstants::RECOMMENDED_PAGE_SIZE);
$ret = array();
do {
// Make the get request.
$page = $targetingIdeaService->get($selector);
// Display results.
if (isset($page->entries))
{
foreach ($page->entries as $adGroupAd)
{
$ret[] = array(
'keyword text' => $adGroupAd->data[0]->value->value,
'searchvolume' => $adGroupAd->data[1]->value->value,
);
}
}
// Advance the paging index.
$selector->paging->startIndex +=
AdWordsConstants::RECOMMENDED_PAGE_SIZE;
} while ($page->totalNumEntries > $selector->paging->startIndex);
return $ret;
}
and i am getting result as
Array ( [0] => Array ( [keyword text] => lease-accounting [searchvolume]
=> -619437956526634531 ) )
i got this from keyword planner tool
<https://lh4.googleusercontent.com/-rAlLr6W_hcA/U2jT_JYbHMI/AAAAAAAAAB8/tV6hiGIrvrc/s1600/Google+AdWords++Keyword+Planner.png>
>
Please help me out of this.
Thanks,
Sugappriya
> Can anyone please let me know the steps to get search volume of keywords
> in php?
>
>
> Thanks,
> Sugappriya
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.