Hi Máté.

I think that this is problem is not API-related.
It is PHP-based. Problem is in your Soap object constructor.

As and Idea - run example for TargetingIdeaService from library
example (by default it will save logs) and compare
raw requests - generated by official library and yours.

If this will not help for you - I'll can to try solve your problem,
but after January 10th.

Regards,
Evgeniy.

On 5 янв, 17:02, Máté Markovics <[email protected]> wrote:
> Hi,
> I wrote a file and I got an error.
> What is wrong?
> Please help!
>
> Error code: Fatal error: Uncaught SoapFault exception: [soap:Client]
> Unmarshalling Error: Unable to create an instance of
> com.google.ads.api.services.targetingideas.v201101.jaxbgen.SearchParameter
> in /web/tesztfeladat/tesztfeladat/noclientlibrary.php:83 Stack trace:
> #0 /web/tesztfeladat/tesztfeladat/noclientlibrary.php(83): 
> SoapClient->__soapCall('get', Array, NULL, Object(SoapHeader)) #1 {main} 
> thrown
>
> in /web/tesztfeladat/tesztfeladat/noclientlibrary.php on line 83
>
> File:
>
> <?php
> // Get authorisation token
> $auth_url = 'https://www.google.com/accounts/ClientLogin';
>
> // Setup data to pass to Google
> $data = array(
>     'accountType' => 'GOOGLE',
>     'Email' => '[email protected]',
>     'Passwd' => '********',
>     'source'=> 'Markovics API',
>     'service'=> 'adwords');
>
> // Try to fetch the authorisation code from Google
> $curl = curl_init($auth_url);
> curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
> curl_setopt($curl, CURLOPT_POST, 1);
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
> $authorisation_code = curl_exec($curl);
>
> // Close the curl connection
> curl_close($curl);
>
> // Create the authorisation codes
> $authorisation_codes = explode("\n", $authorisation_code);
> $authorisation_code = array();
> $authorisation_code['SID'] = str_replace('SID=', '',
> $authorisation_codes[0]);
> $authorisation_code['LSID'] = str_replace('LSID=', '',
> $authorisation_codes[1]);
> $authorisation_code['Auth'] = str_replace('Auth=', '',
> $authorisation_codes[2]);
>
> // Get the service information
> $url = 'https://adwords-sandbox.google.com/api/adwords/o/v201101/
> TargetingIdeaService?wsdl';
> $namespace = 'https://adwords.google.com/api/adwords/o/v201101';
> $options = array(
>     'trace' => true,
>     'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
>     'encoding' => 'utf-8');
>
> // Setup the headers
> $headers = array(
>     "developerToken" => 'SOME_DEVELOPER_CODE',
>     "userAgent" => "testing",
>     "authToken" => $authorisation_code['Auth']
> );
> $encoded_headers = new SoapHeader($namespace, "RequestHeader",
> $headers, false);
>
> // Setup keyword
> $keyword = array();
> $keyword['text'] = 'kitchen appliance centre';
> $keyword['matchType'] = 'BROAD';
>
> // Setup paging
> $paging = array();
> $paging['startIndex'] = 0;
> $paging['numberResults'] = 10;
>
> // Setup related to keyword search parameter
> $related_to_keyword_search_parameter = array();
> $related_to_keyword_search_parameter['keywords'] = array($keyword);
>
> // Setup keyword match type search parameter to ensure unique results
> $keyword_match_type_search_parameter = array();
> $keyword_match_type_search_parameter['keywordMatchTypes'] =
> array('BROAD');
>
> // Setup selector
> $selector = array();
> $selector['requestType'] = 'IDEAS';
> $selector['ideaType'] = 'KEYWORD';
> $selector['requestedAttributeTypes'] = array('CRITERION',
> 'AVERAGE_TARGETED_MONTHLY_SEARCHES');
> $selector['paging'] = $paging;
> $selector['searchParameters'] =
> array($related_to_keyword_search_parameter,
> $keyword_match_type_search_parameter);
>
> // Setup the request
> $request = array(
>     "get" => array(
>         "selector" => $selector
>     )
> );
>
> // Request the data
> $client = new SoapClient($url, $options);
> $result = $client->__soapCall("get", $request, null,
> $encoded_headers);
> ?>
>
> Thank you very much!

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

Reply via email to