i use the code below:

# 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://adwords.google.cn/api/adwords/v12';
$keyword_tool_service = SoapClientFactory::GetClient(
  $namespace . '/KeywordToolService?wsdl', 'wsdl');
$keyword_tool_service->setHeaders($headers);
$debug = 1;

# Create seed keyword structure.
$seed_keyword =
  '<negative>false</negative>' .
  '<text>tea</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);
}
?>

And the response you can see at the url of "http://
ainihong001.byethost33.com/get_keyword_variations.php".

tks
it is my first to use the adwords api. and i have no idea.
Seam. ainihong...@126.com

On 2月14日, 上午2时31分, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> If you're just getting started with AdWords API development, I'd
> recommend that you first read through the official documentation:
>
>  http://code.google.com/apis/adwords/docs/developer/index.html
>
> If your language of choice is PHP, I'd recommend that you use the
> APIlity client library instead of the sample code. The sample code is
> meant to provide a standalone reference as to how to call certain API
> functions, but isn't the right choice if you're developing a full
> application. APIlity can be downloaded from
>
>  http://google-apility.sourceforge.net/
>
> If you're still having problems, please provide a log of the SOAP
> request and response that you're sending and receiving, making sure
> that you X out your token and password information.
>
> Cheers,
> -Jeff Posnick, AdWords API Team
>
> On Feb 13, 11:05 am, ainihong001 <ainihong...@126.com> wrote:
>
> > i have got developer_token and application_token,
> > i use the demo of get_keyword_variations.php .
> > But it returns "List of additional keywords to consider has 0 variation
> > (s). List of popular queries with given seed has 0 variation(s).",
>
> > it shows maybe the method of getKeywordVariations not work rightly.
>
> > tks
> > helping me.
--~--~---------~--~----~------------~-------~--~----~
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