Nevermind guys, i found the solution i have to pass a array instead a string
$campaignService->query(array("query" =>"SELECT CampaignName WHERE
Impressions > 10 "));
Em sexta-feira, 6 de julho de 2012 11h33min02s UTC-3, Eduardo Hiroshi
Campos Tamaki escreveu:
>
> Hi guys,I'm a little new using the SOAP API, and for it's not working to
> do some queries.
>
> Google has announces de AWQL, and i'm trying to use:
>
> See the code and the error below:
>
> <?php
> error_reporting(E_STRICT | E_ALL);
>
> // Provide AdWords login information.
> $email = "xxx";
> $password ="xxx";
> $developerToken = "xxx";
> $userAgent = "xxx";
> $clientCustomerId = "xxx";
> $params = array(
> 'Email' => $email,
> 'Passwd' => $password,
> 'accountType' => 'GOOGLE',
> 'service' => 'adwords',
> 'source' => 'AdWords API PHP Code Example');
>
> $url = 'https://www.google.com/accounts/ClientLogin';
>
> // Make request
> $ch = curl_init($url);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
> $response = curl_exec($ch);
> curl_close($ch);
>
> // Parse response.
> $lines = explode("\n", $response);
> foreach ($lines as $line) {
> $parts = explode('=', $line, 2);
> if ($parts[0] == 'Auth') {
> $authToken = $parts[1];
> }
> if ($parts[0] == 'Error') {
> $error = $parts[1];
> }
> }
>
> // Display results.
> if (isset($authToken)) {
> print 'Auth token: ' . $authToken . "\n";
> } else if (isset($error)) {
> print 'Error: ' . $error . "\n";
> }
> $wsdl = '
> https://adwords.google.com/api/adwords/cm/v201206/CampaignService?wsdl';
> $namespace = 'https://adwords.google.com/api/adwords/cm/v201206';
> $options = array(
> 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
> 'encoding' => 'utf-8');
>
> // Get CampaignService.
> $campaignService = new SoapClient($wsdl, $options);
>
> $headers = new SoapHeader($namespace, 'RequestHeader', array(
> 'authToken' => $authToken,
> 'clientCustomerId' => $clientCustomerId,
> 'userAgent' => $userAgent,
> 'developerToken' => $developerToken));
> $campaignService->__setSoapHeaders($headers);
> $campaingService->query("SELECT CampaignName WHERE Impressions > 10 ");
>
> PHP Warning: Uncaught SoapFault exception: [soap:Server]
> [RequiredError.REQUIRED @ query] in php shell code:1
> Stack trace:
> #0 php shell code(1): SoapClient->__call('query', Array)
> #1 php shell code(1): SoapClient->query('SELECT Campaign...')
> #2 {main}
>
> So I'm logged in the soap, and i can't do the queries...
>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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