I'm trying to connect to AdSense API using a PHP script. I started using this tutorial by google: https://developers.google.com/api-client-library/php/start/get_started#build-the-client-object
However, I didn't manage to connect. This is what I've tried:
$client = new Google_Client();
$client->setApplicationName("AppName");
$client->setDeveloperKey(API_Key);
$client->setAuthConfigFile('../AdSense/google-api-php-client/client_secret.json');
$service = new Google_Service_AdSenseTest($client);
$results = $service->testReportsGenerate();
foreach($results as $item)
{
echo $item;
}
And I came across a few problems, the main one is that the code doesn't recognize the "Google_Service_AdSenseTest" class - even though the code suggested it. So my real question is this: What service should I use if I want to pull data from AdSense? And how do I set the needed parameters (meaning - which dimensions and metrics to get)?
Thank you.