hi all,

i m using this code for google api searchvolume can anyone helps me in
getting search volume. when i use

Targetingideaservice its shows nothing in output.

hope anyone reply soon in this regards.


<?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 traffic estimate for the requested
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';
$estimator_service = SoapClientFactory::GetClient(
$namespace . '/GetTargetingIdeaService?wsdl');
$estimator_service->setHeaders($headers);
$debug = 0;

# Create keyword structure.
 $keyword =
   '<keywordText>mars cruise</keywordText>' .
   '<keywordType>Exact</keywordType>' .
   '<language>en</language>';

# Check keyword traffic.
 $request_xml =
   '<checkKeywordTraffic>' .
   '<requests>' . $keyword . '</requests>' .
   '</checkKeywordTraffic>';
 $estimates = $estimator_service->call('checkKeywordTraffic',
$request_xml);
 $estimates = $estimates['checkKeywordTrafficReturn'];
 if ($debug) show_xml($estimator_service);
 if ($estimator_service->fault) show_fault($estimator_service);

 # Display estimate.
echo 'Estimate for keyword "mars cruise" is "' . $estimates . '".' .
"\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);
 }
 ?>


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