This is my code, which works for a regular request, but when I turn it
into getBulkKeywordIdeas, I get the SOAP error below saying
TargetingIdeaError.INVALID_SEARCH_PARAMETERS.  I tried searching but
everything i read said I had to add RelatedToUrlSearchParameter, and I
did, but I still end up with this error. What can I do?

Thanks in advance,
Mauricio



function getkeywords($v, $type, $list) {

        $xarray = array();
        global $user;
        $seedKeywords = array();
        $seedKeywords[] = array( 'text' => trim( $v ), 'type' => $type,
'isNegative' => false );


        $targetingIdeaService = $user->GetTargetingIdeaService('v200909');

        $mykeyword = array();
        foreach ($v as $vv) {
        $keyword = new Keyword();
        $keyword->text = $vv;
        $keyword->matchType = $type;
        $mykeyword[] = $keyword;
        }
        $keyword2 = new Keyword();
        $keyword2->text = 'test';
        $keyword2->matchType = $type;
        $selector = new TargetingIdeaSelector();
        $selector->requestType = 'IDEAS';
        $selector->ideaType = 'KEYWORD';
        $url = 'www.example.com';
        $paging = new Paging();
        $paging->startIndex = 0;
        $paging->numberResults = 10;
        $selector->paging = $paging;
        $relatedToKeywordSearchParameter = new
RelatedToUrlSearchParameter();
        $relatedToKeywordSearchParameter->urls = array($url);
        $relatedToKeywordSearchParameter->keywords = array($keyword2);
        $keywordMatchTypeSearchParameter = new
KeywordMatchTypeSearchParameter();
        $keywordMatchTypeSearchParameter->keywordMatchTypes = array($type);
        $selector->searchParameters = array($relatedToKeywordSearchParameter,
$keywordMatchTypeSearchParameter);
        $selector->requestedAttributeTypes = array('KEYWORD',
'AVERAGE_TARGETED_MONTHLY_SEARCHES');
        $page = $targetingIdeaService->getBulkKeywordIdeas($selector);
        $xarray;
        $temparray;
        $i=0;
        if (isset($page->entries)) {
                foreach ($page->entries as $targetingIdea) {
                        $data = MapUtils::GetMap($targetingIdea->data);
                        $keyword = $data['KEYWORD']->value;
                        $averageMonthlySearches =
isset($data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value) ?
$data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value : 0;
                        switch($list) {
                                case '1':
                                        if($averageMonthlySearches >= 
$searchVolThreshold1) {
                                        $temparray[$i] = $keyword->text;
                                        $i++;
                                        }
                                break;
                                case '2':
                                        if($averageMonthlySearches >= 
$searchVolThreshold2) {
                                        $temparray[$i] = $keyword->text;
                                        $i++;
                                }
                                break;
                                default:
                                break;
                        }
                }
        } else {
                print "No related keywords were found.\n";
        }

        return $temparray;

}



-------
Full error message
-------

SoapFault Object
(
    [message:protected] =>
[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[1]; trigger:'KeywordMatchType']
    [string:private] =>
    [code:protected] => 0
    [file:protected] => /home/lp21/public_html/adrisr.com/google/
Google/Api/Ads/Common/Lib/AdsSoapClient.php
    [line:protected] => 179
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] => /home/lp21/public_html/adrisr.com/google/
Google/Api/Ads/Common/Lib/AdsSoapClient.php
                    [line] => 179
                    [function] => __soapCall
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => getBulkKeywordIdeas
                            [1] => Array
                                (
                                    [0] => getBulkKeywordIdeas Object
                                        (
                                            [selector] =>
TargetingIdeaSelector Object
                                                (
                                                    [searchParameters]
=> Array
                                                        (
                                                            [0] =>
RelatedToUrlSearchParameter Object
                                                                (
 
[urls] => Array
 
(
 
[0] => www.example.com
                                                                        )

 
[includeSubUrls] =>
 
[SearchParameterType] =>
 
[_parameterMap:private] => Array
 
(
 
[SearchParameter.Type] => SearchParameterType
                                                                        )

                                                                )

                                                            [1] =>
KeywordMatchTypeSearchParameter Object
                                                                (
 
[keywordMatchTypes] => Array
 
(
 
[0] => BROAD
                                                                        )

 
[SearchParameterType] =>
 
[_parameterMap:private] => Array
 
(
 
[SearchParameter.Type] => SearchParameterType
                                                                        )

                                                                )

                                                        )

                                                    [ideaType] =>
KEYWORD
                                                    [requestType] =>
IDEAS
 
[requestedAttributeTypes] => Array
                                                        (
                                                            [0] =>
KEYWORD
                                                            [1] =>
AVERAGE_TARGETED_MONTHLY_SEARCHES
                                                        )

                                                    [paging] => Paging
Object
                                                        (
 
[startIndex] => 0
 
[numberResults] => 10
                                                        )

                                                    [localeCode] =>
                                                    [currencyCode] =>
                                                )

                                        )

                                )

                            [2] =>
                            [3] => Array
                                (
                                    [0] => SoapHeader Object
                                        (
                                            [namespace] =>
https://adwords.google.com/api/adwords/o/v200909
                                            [name] => RequestHeader
                                            [data] => SoapVar Object
                                                (
                                                    [enc_type] => 301
                                                    [enc_value] =>
SoapRequestHeader Object
                                                        (
 
[applicationToken] => /* removed */
 
[authToken] =>
DQAAAKkAAAAPUYwjVuufxO4RcoVTZw4UNqgd8Ie73EdEg6rJzfVhwLC6nqqa045bM3XYCpxHoiDtuEbyMaLBLOwp_SDW0Z0GLKwQ4-
VwqTBTcZ3NVqjx_E3YR-TV6TCoYWj9SNcqMb4mL_gWz63cuVoW_fXUzI-HoAPG44iqy6d-
crUAf2aTOMNDXyWmj2N40HKCsZ7RULD7BXocFbTiteK2_BaTXIAZNybR3A9QgGJeCQogueijPg
 
[clientCustomerId] =>
 
[clientEmail] =>
 
[developerToken] => /* removed */
 
[userAgent] => AwApi-PHP-2.2.0-
 
[validateOnly] =>
                                                        )

                                                    [enc_stype] =>
RequestHeader
                                                    [enc_ns] =>
https://adwords.google.com/api/adwords/cm/v200909
                                                )

                                            [mustUnderstand] =>
                                        )

                                )

                            [4] => Array
                                (
                                )

                        )

                )

            [1] => Array
                (
                    [file] => /home/lp21/public_html/adrisr.com/google/
Google/Api/Ads/AdWords/v200909/o/TargetingIdeaService.php
                    [line] => 6549
                    [function] => __soapCall
                    [class] => AdsSoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => getBulkKeywordIdeas
                            [1] => Array
                                (
                                    [0] => getBulkKeywordIdeas Object
                                        (
                                            [selector] =>
TargetingIdeaSelector Object
                                                (
                                                    [searchParameters]
=> Array
                                                        (
                                                            [0] =>
RelatedToUrlSearchParameter Object
                                                                (
 
[urls] => Array
 
(
 
[0] => www.example.com
                                                                        )

 
[includeSubUrls] =>
 
[SearchParameterType] =>
 
[_parameterMap:private] => Array
 
(
 
[SearchParameter.Type] => SearchParameterType
                                                                        )

                                                                )

                                                            [1] =>
KeywordMatchTypeSearchParameter Object
                                                                (
 
[keywordMatchTypes] => Array
 
(
 
[0] => BROAD
                                                                        )

 
[SearchParameterType] =>
 
[_parameterMap:private] => Array
 
(
 
[SearchParameter.Type] => SearchParameterType
                                                                        )

                                                                )

                                                        )

                                                    [ideaType] =>
KEYWORD
                                                    [requestType] =>
IDEAS
 
[requestedAttributeTypes] => Array
                                                        (
                                                            [0] =>
KEYWORD
                                                            [1] =>
AVERAGE_TARGETED_MONTHLY_SEARCHES
                                                        )

                                                    [paging] => Paging
Object
                                                        (
 
[startIndex] => 0
 
[numberResults] => 10
                                                        )

                                                    [localeCode] =>
                                                    [currencyCode] =>
                                                )

                                        )

                                )

                        )

                )

            [2] => Array
                (
                    [file] => /home/lp21/public_html/adrisr.com/google/
adkeywordtool.php
                    [line] => 136
                    [function] => getBulkKeywordIdeas
                    [class] => TargetingIdeaService
                    [type] => ->
                    [args] => Array
                        (
                            [0] => TargetingIdeaSelector Object
                                (
                                    [searchParameters] => Array
                                        (
                                            [0] =>
RelatedToUrlSearchParameter Object
                                                (
                                                    [urls] => Array
                                                        (
                                                            [0] =>
www.example.com
                                                        )

                                                    [includeSubUrls]
=>
 
[SearchParameterType] =>
 
[_parameterMap:private] => Array
                                                        (
 
[SearchParameter.Type] => SearchParameterType
                                                        )

                                                )

                                            [1] =>
KeywordMatchTypeSearchParameter Object
                                                (
 
[keywordMatchTypes] => Array
                                                        (
                                                            [0] =>
BROAD
                                                        )

 
[SearchParameterType] =>
 
[_parameterMap:private] => Array
                                                        (
 
[SearchParameter.Type] => SearchParameterType
                                                        )

                                                )

                                        )

                                    [ideaType] => KEYWORD
                                    [requestType] => IDEAS
                                    [requestedAttributeTypes] => Array
                                        (
                                            [0] => KEYWORD
                                            [1] =>
AVERAGE_TARGETED_MONTHLY_SEARCHES
                                        )

                                    [paging] => Paging Object
                                        (
                                            [startIndex] => 0
                                            [numberResults] => 10
                                        )

                                    [localeCode] =>
                                    [currencyCode] =>
                                )

                        )

                )

            [3] => Array
                (
                    [file] => /home/lp21/public_html/adrisr.com/google/
adkeywordtool.php
                    [line] => 203
                    [function] => getkeywords
                )

        )

    [faultstring] => [TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[1]; trigger:'KeywordMatchType']
    [faultcode] => soap:Server
    [detail] => stdClass Object
        (
            [ApiExceptionFault] => stdClass Object
                (
                    [message] =>
[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[1]; trigger:'KeywordMatchType']
                    [ApplicationException.Type] => ApiException
                    [errors] => SoapVar Object
                        (
                            [enc_type] => 0
                            [enc_value] => TargetingIdeaError Object
                                (
                                    [reason] =>
INVALID_SEARCH_PARAMETERS
                                    [fieldPath] =>
selector.selector.searchParameters[1]
                                    [trigger] => KeywordMatchType
                                    [ApiErrorType] =>
TargetingIdeaError
                                    [_parameterMap:private] => Array
                                        (
                                            [ApiError.Type] =>
ApiErrorType
                                        )

                                )

                            [enc_stype] => TargetingIdeaError
                            [enc_ns] => 
https://adwords.google.com/api/adwords/o/v200909
                        )

                )

        )

)

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