Hi Guys,

I'm new to Google API, so I would really appreciate some help here :)

I'm having problem using TargetingIdeaService v201209 with 
GetKeywordIdeasExample. If I send array like that: 

array_unique(array("smart 
tv","truck","Ipad","porshe","bmw","fiat","hotels","Iphone","car","Tablet","omega3"));
 
it works fine I can get keywords and category ids back. 

But if I repeat a keyword (car) like that:  

array_unique(array("*car*","smart 
tv","truck","Ipad","porshe","bmw","fiat","hotels","Iphone","*car*
","Tablet","omega3"));

Even using array_unique to remove repeated keywords I get this result which 
only returned the same ids no matter how different the keywords are :

*Notice Error: Array to string conversion in 
[/var/www/sorting-hat/app/Vendor/Google/Google/Api/Ads/Common/Lib/AdsSoapClient.php,
 
line 200]*

string(5) "array"
KW: 

array(6) {
  [0]=>
  int(13111)
  [1]=>
  int(10885)
  [2]=>
  int(12197)
  [3]=>
  int(10019)
  [4]=>
  int(12211)
  [5]=>
  int(10168)
}
array(0) {
}


        public function GetKeywordIdeasExample(AdWordsUser $user)
        {
                    $arrKeyword = array_unique(array("smart 
tv","truck","Ipad","porshe","bmw","fiat","hotels","Iphone","car","Tablet","omega3"));
            $targetingIdeaService = 
$user->GetService('TargetingIdeaService', 'v201209');
            // Create selector.
            $selector = new TargetingIdeaSelector();
            $selector->requestType = 'STATS';
            $selector->ideaType = 'KEYWORD';
            $selector->requestedAttributeTypes = 
array('KEYWORD_TEXT','CATEGORY_PRODUCTS_AND_SERVICES');

            // Create related to query search parameter.
            $relatedToQuerySearchParameter = new 
RelatedToQuerySearchParameter();
            $relatedToQuerySearchParameter->queries = $arrKeyword;
            $selector->searchParameters[] = $relatedToQuerySearchParameter;

            // Set selector paging (required by this service).
            $selector->paging = new Paging(0, 
AdWordsConstants::RECOMMENDED_PAGE_SIZE);
            do {
                // Make the get request.
                $page = $targetingIdeaService->get($selector);

                if (isset($page->entries))
                {
                    foreach ($page->entries as $targetingIdea)
                    {
                        $data = MapUtils::GetMap($targetingIdea->data);
                        $keyword = $data['KEYWORD_TEXT']->value;
                                echo "KW: ". var_dump($keyword) ."\n\n";

                        if 
(is_array($data['CATEGORY_PRODUCTS_AND_SERVICES']->value))
                        {
                            $categories = 
$data['CATEGORY_PRODUCTS_AND_SERVICES']->value;
                                    var_dump($categories)."\n\n";

                        }
                    }

                } else {
                    echo "No results\n";
                }

                // Advance the paging index.
                $selector->paging->startIndex += 
AdWordsConstants::RECOMMENDED_PAGE_SIZE;
            } while ($page->totalNumEntries > 
$selector->paging->startIndex);

               $this->out("End:" . date("Y-m-d H:i:s"));
     }  


Thanks in advance!
Fran

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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