Please, Help me....
I would like to use the Google AdSense API to get my Earnings through PHP.
But sample code is not working.
PUTTY - SSH connect
Install 'Composer'
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'aa96f26c2b67226a324c27919f1eb05f21c248b987e6195cad9690d5c1ff713d53020a02ac8c217dbf90a7eacc9d141d') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Install 'Google APIs Client Library for PHP'
php composer.phar require google/apiclient:^2.0
Copy the AdSense Management API sample for PHP to your server.
https://github.com/googleads/googleads-adsense-examples/tree/master/php-clientlib-1.x/v1.x
Modify client_secrets.json
client ID, client secret and redirect URL
- Open the sample in browser. Sample code is But not working
......T_T
- I tried many different ways while two weeks
My guess is that the path is a problem. But that is wrong to that.
[adsense-sample.php - Before]
/************************************************
ATTENTION: Change this path to point to your
client library installation!
************************************************/
set_include_path('/path/to/clientlib' . PATH_SEPARATOR . get_include_path());
require_once 'Google/Client.php';
require_once 'Google/Service/AdSense.php';
// Autoload example classes.
function __autoload($class_name) {
include 'examples/' . $class_name . '.php';
}
↓
[adsense-sample.php - After]
require_once __DIR__.'/vendor/autoload.php';
require_once 'templates/base.php';
require_once 'examples/CollateReportData.php';
require_once 'examples/FillMissingDatesInReport.php';
require_once 'examples/GenerateReport.php';
require_once 'examples/GenerateReportWithPaging.php';
require_once 'examples/GenerateSavedReport.php';
require_once 'examples/GetAccountTree.php';
require_once 'examples/GetAllAccounts.php';
require_once 'examples/GetAllAdClients.php';
require_once 'examples/GetAllAdUnits.php';
require_once 'examples/GetAllAdUnitsForCustomChannel.php';
require_once 'examples/GetAllAlerts.php';
require_once 'examples/GetAllCustomChannels.php';
require_once 'examples/GetAllCustomChannelsForAdUnit.php';
require_once 'examples/GetAllDimensions.php';
require_once 'examples/GetAllMetrics.php';
require_once 'examples/GetAllSavedAdStyles.php';
require_once 'examples/GetAllSavedReports.php';
require_once 'examples/GetAllUrlChannels.php';
Please, help me...