Hello guys,

I have been trying to get a users data who previously authorized the 
application, but it keeps returning 

Fatal error: Uncaught ReflectionException: Property does not exist in 

The property does indeed exist as it is my test account I am running it 
against.

ViewID for test account = *7827124895*

When I run the script it does not populate my log files at all.

My code below.

    $user = new AdWordsUser();
    $user->setUserAgent($userAgent);
    $user->SetDeveloperToken($devToken);

    $OAuthDetails = array(
        "client_id" => $clientId,
        "client_secret" => $clientSecret,
        "access_token" => $dbUser["access_token"],
        "access_type" => "offline",
        "refresh_token" => $dbUser["refresh_token"]
    );

    $user->SetOAuth2Info($OAuthDetails);
    $oauthHandler = $user->GetDefaultOAuth2Handler();
    $user->LogAll();
    
    $newToken = $oauthHandler->GetOrRefreshAccessToken($OAuthDetails);
    $user->SetOAuth2Info($newToken);

    $accounts = explode(',', $dbUser['viewID']);

    foreach($accounts as $account) {
        $user->SetClientCustomerId($account);
        print_r($account);
        getAndSaveAccountData($db, $dbUser['userID'], $user, $account);
    }

function getAndSaveAccountData($db, $userID, $user, $id) {
    $options = array('version' => 'v201605');
    $options['includeZeroImpressions'] = true;
    $options['skipColumnHeader'] = true;
    $options['skipReportHeader'] = true;
    $options['skipReportSummary'] = true;

    $today = date("Ymd");
    $yesterday = date('Ymd', strtotime('-1 days'));

    $reportQuery = "SELECT Date, Cost, Conversions, CostPerConversion, 
ConversionRate FROM ACCOUNT_PERFORMANCE_REPORT DURING $today, $yesterday";

    $reportUtils = new ReportUtils();
    $data = $reportUtils->DownloadReportWithAwql($reportQuery, null, $user, 
"CSV", $options);
    $rows = [];
    print_r("data = ");
    print_r($rows);


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/5b22e474-99f6-4a37-904f-0b1b7f4d4fc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to