Hello,

 It sounds like you're using your Production AdWords credentials to
access the Sandbox environment. Please see the comment in the code
about switching from sandbox.google.com to adwords.google.com if you
want to get your code working in Production.

 Alternatively, if you're doing new development in PHP, I'd recommend
that you check out the APIlity client library instead of directly
modifying the sample code:

  http://google-apility.sourceforge.net/

Cheers,
-Jeff Posnick, AdWords API Team


On Mar 14, 7:47 am, gloradin <[email protected]> wrote:
> Hi,
> After I take the authorization, I went to the sample code, and I take
> the example for "Keywords variations":
> I put the code in index.php
> This one:
> =====================================
> <?php
>  // Copyright 2009, Google Inc. All Rights Reserved.
>  //
>  // Licensed under the Apache License, Version 2.0 (the "License");
>  // you may not use this file except in compliance with the License.
>  // You may obtain a copy of the License at
>  //
>  //    http://www.apache.org/licenses/LICENSE-2.0
>  //
>  // Unless required by applicable law or agreed to in writing,
> software
>  // distributed under the License is distributed on an "AS IS" BASIS,
>  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>  // See the License for the specific language governing permissions
> and
>  // limitations under the License.
>
>  /** This code sample retrieves variations for a seed keyword. */
>
>  require_once('soapclientfactory.php');
>
>  # Provide AdWords login information.
>  $email = 'INSERT_LOGIN_EMAIL_HERE';
>  $password = 'INSERT_PASSWORD_HERE';
>  $client_email = 'INSERT_CLIENT_LOGIN_EMAIL_HERE';
>  $useragent = 'INSERT_COMPANY_NAME: AdWords API PHP Sample Code';
>  $developer_token = 'INSERT_DEVELOPER_TOKEN_HERE';
>  $application_token = 'INSERT_APPLICATION_TOKEN_HERE';
>
>  # Define SOAP headers.
>  $headers =
>    '<email>' . $email . '</email>'.
>    '<password>' . $password . '</password>' .
>    '<clientEmail>' . $client_email . '</clientEmail>' .
>    '<useragent>' . $useragent . '</useragent>' .
>    '<developerToken>' . $developer_token . '</developerToken>' .
>    '<applicationToken>' . $application_token . '</applicationToken>';
>
>  # Set up service connection. To view XML request/response, change
> value of
>  # $debug to 1. To send requests to production environment, replace
>  # "sandbox.google.com" with "adwords.google.com".
>  $namespace = 'https://sandbox.google.com/api/adwords/v13';
>  $keyword_tool_service = SoapClientFactory::GetClient(
>    $namespace . '/KeywordToolService?wsdl', 'wsdl');
>  $keyword_tool_service->setHeaders($headers);
>  $debug = 0;
>
>  # Create seed keyword structure.
>  $seed_keyword =
>    '<negative>false</negative>' .
>    '<text>mars cruise</text>' .
>    '<type>Broad</type>';
>  $use_synonyms = '<useSynonyms>true</useSynonyms>';
>
>  # Get keyword variations.
>  $request_xml =
>    '<getKeywordVariations>' .
>    '<seedKeywords>' . $seed_keyword . '</seedKeywords>' .
>    $use_synonyms .
>    '<languages>en</languages>' .
>    '<countries>US</countries>' .
>    '</getKeywordVariations>';
>  $variation_lists =
>    $keyword_tool_service->call('getKeywordVariations', $request_xml);
>  $variation_lists = $variation_lists['getKeywordVariationsReturn'];
>  if ($debug) show_xml($keyword_tool_service);
>  if ($keyword_tool_service->fault) show_fault($keyword_tool_service);
>
>  # Display keyword variations.
>  $to_consider = $variation_lists['additionalToConsider'];
>  echo 'List of additional keywords to consider has ' . count
> ($to_consider) .
>    ' variation(s).' . "\n";
>
>  $more_specific = $variation_lists['moreSpecific'];
>  echo 'List of popular queries with given seed has ' . count
> ($more_specific) .
>    ' variation(s).' . "\n";
>
>  function show_xml($service) {
>    echo $service->request;
>    echo $service->response;
>    echo "\n";
>  }
>
>  function show_fault($service) {
>    echo "\n";
>    echo 'Fault: ' . $service->fault . "\n";
>    echo 'Code: ' . $service->faultcode . "\n";
>    echo 'String: ' . $service->faultstring . "\n";
>    echo 'Detail: ' . $service->faultdetail . "\n";
>    exit(0);
>  }
>  ?>
>  ==============================================
> I create the file soapclientfactory.php, and I take the nusoap files
> and put in my server.
> I execute the code and I get this response, view in the browser:
> Fault: 1 Code: soapenv:Server.userException String: The developer
> token is invalid. Detail:
>  $email = '[email protected]';
>  $password = 'my password to enter in [email protected]';
>  $client_email = 'INSERT_CLIENT_LOGIN_EMAIL_HERE'; //is optional, I
> put like a comment //
>  $useragent = 'INSERT_COMPANY_NAME: AdWords API PHP Sample Code'; //I
> don't know, so I don't put nothing
>  $developer_token = 'INSERT_DEVELOPER_TOKEN_HERE'; //provide in email
> send by adwords
>  $application_token = 'INSERT_APPLICATION_TOKEN_HERE'; //provide in
> email send by adwords
>
> Observations:
> I can execute this code in any server account, is indifferent I
> execute index.php in gloradin.com or other domain?
> I have two accounts in adwords, [email protected] where I have my
> campaigns and [email protected], this one is the e-mail I use for
> enter in adwords API. But if I open [email protected] I can get
> access to [email protected] account, maybe this have influence in
> these lines:
> $email = '[email protected]';
> $password = 'my password to enter in [email protected]';  ?????
>
> So, what I need to view the adwords api works?
>
> The best regards,
> JC
--~--~---------~--~----~------------~-------~--~----~
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