So I manage to authenticate using the examples of the client library and by my own script and both are giving me empty results.
It does give me some results.
<?php
session_start();
require_once 'src/Google_Client.php';
require_once 'src/contrib/Google_AdsenseService.php';
$client = new Google_Client();
$client -> setApplicationName('Ad Sense Revenue');
$client -> setClientId('#clientid');
$client -> setClientSecret('#clientsecret');
$client -> setDeveloperKey('#apikey');
$service = new Google_AdSenseService($client);
if (isset($_GET['logout'])) { // logout: destroy token
unset($_SESSION['token']);
die('Logged out.');
}
if (isset($_GET['code'])) { // we received the positive auth callback, get the token and store it in session
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
}
if (isset($_SESSION['token'])) { // extract token from session and configure client
$token = $_SESSION['token'];
$client->setAccessToken($token);
}
if (!$client->getAccessToken()) { // auth call to google
$authUrl = $client->createAuthUrl();
header("Location: ".$authUrl);
die;
}
try {
$optParams = array('metric' => array('earnings'), 'dimension' => 'date');
$data = $service -> reports -> generate('2013-01-01', '2013-03-03', $optParams);
echo '<pre>' . print_r($data, TRUE) . '</pre>';
} catch(Exception $e) {
echo '<pre>', print_r($e, TRUE) . '</pre>';
}