0
我试图使用PHP脚本连接到AdSense API。 我开始使用本教程由谷歌:https://developers.google.com/api-client-library/php/start/get_started#build-the-client-object通过PHP连接到Google AdSense API
但是,我没有设法连接。这是我已经试过:
$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;
}
而且我碰到了一些问题来了,最主要的是,该代码不承认“Google_Service_AdSenseTest”类 - 即使代码建议吧。 所以我真正的问题是:如果我想从AdSense中提取数据,应该使用什么服务?我如何设置所需的参数(意思 - 要获得哪些维度和指标)?
谢谢。