Hi Vishal,
Thanks for the replay
I have used below steps for it
Request a developer token
<https://developers.google.com/adwords/api/docs/guides/first-api-call#request_a_developer_token>
- I got developer token
Create test accounts
<https://developers.google.com/adwords/api/docs/guides/first-api-call#create_test_accounts>
- Can you please explain process for it with screenshot step by step or
provide any test credential.
Get a client library
<https://developers.google.com/adwords/api/docs/guides/first-api-call#get_a_client_library>
- Downloaded googleads-php-lib latest v13.0.0 in github
(https://github.com/googleads/googleads-php-lib).
- Created oauth2 client id and client secret code.
developerToken = Done
userAgent = *Can you please tell me how we get userAgent ? *
clientCustomerId = Done
client_id = Done
client_secret = Done
refresh_token = Done
- Created one folder as name "adwordsNew" and paste all downloaded php library
in there.
- Created one php file as name "My_adwords.php" and put below script
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/src");
require_once("Google/Api/Ads/AdWords/Lib/AdWordsUser.php");
//require_once ADWORDS_UTIL_VERSION_PATH . '/ReportUtils.php';
define("OAUTH_CLIENT_ID",
"[137211462444-nunvhjrg6biksjg0hshutsdgvgfb18c7.apps.googleusercontent.com]");
define("OAUTH_CLIENT_SECRET", "[KRAC_kvJws04s05lDC-6707q]");
define("OAUTH_ACCESS_TOKEN",
"[ya29.Ci9cA8_TaheqCmCJXbwclgIJ0PSuC1GfSr7wYgp_Q7tFmClpFTDy-LjAuxLRX_Xacg]");
define("OAUTH_REFRESH_TOKEN",
"[1/eQTbYPGYj8SgCDetRGrgUTgHcOFAA7YPRgn6MMn3r54]");
define("CUSTOMER_ACCOUNT_ID", "[570-185-2150]");
define("DEVELOPER_TOKEN", "[yXJrJrRVP_fobjLcY-tLFg]");
define("API_VERSION", "v201603");
$user = new AdWordsUser();
$user->SetDeveloperToken(DEVELOPER_TOKEN);
$user->SetClientCustomerId(CUSTOMER_ACCOUNT_ID);
$user->SetOAuth2Info(array(
"client_id" => OAUTH_CLIENT_ID,
"client_secret" => OAUTH_CLIENT_SECRET,
"access_token" => OAUTH_ACCESS_TOKEN,
"refresh_token" => OAUTH_REFRESH_TOKEN
));
$campaignService = $user->GetService('CampaignService', 'v201603');
// Create selector.
$selector = new Selector();
$selector->fields = array('Id', 'Name');
$selector->ordering[] = new OrderBy('Name', 'ASCENDING');
// Create paging controls.
$selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
// Make the get request.
$page = $campaignService->get($selector);
print_r($page);
// $campaignService = $user->GetService('ReportDefinitionService',
ADWORDS_VERSION);
// $selector = new Selector();
// $selector->fields = $reportFields;
$user->LoadService('ReportDefinitionService', API_VERSION);
$reportFormat = "CSV";
$reportQuery = "SELECT Id, KeywordText, KeywordMatchType, Impressions, Clicks "
.
"FROM KEYWORDS_PERFORMANCE_REPORT " .
"DURING THIS_MONTH ";
$options = array(
'version' => API_VERSION,
'includeZeroImpressions' => true,
'returnMoneyInMicros' => true
);
$report = ReportUtils::DownloadReportWithAwql($reportQuery, null, $user,
$reportFormat, $options);
print $report;
?>
And run this script in browser and got a error
How we can generate Refresh token and check client id and client secret
code is correct or not
Can you please check these steps and script and let me right steps and
script for it
Thanks & Regards,
To The Top Software
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/cd28769d-05e2-4d09-be56-6aae470f9650%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.