';谷歌AdSense API';PHP示例代码不起作用

';谷歌AdSense API';PHP示例代码不起作用,php,adsense-api,Php,Adsense Api,请帮帮我 我想使用谷歌AdSense API通过PHP获取收入 但示例代码不起作用 PUTTY-SSH连接 安装“Composer” php-r”if(hash_文件('SHA384','composer setup.php')==='aa96f26c2b67226a324c27919f1c05f21c48b987e6195cad9690d5c1f713d53020a02ac8c17dbf90a7eacc9d141d'){echo'安装程序已验证';}否则{echo'安装程序已损坏';取消链接(

请帮帮我

我想使用谷歌AdSense API通过PHP获取收入

但示例代码不起作用

  • PUTTY-SSH连接

  • 安装“Composer”

    php-r”if(hash_文件('SHA384','composer setup.php')==='aa96f26c2b67226a324c27919f1c05f21c48b987e6195cad9690d5c1f713d53020a02ac8c17dbf90a7eacc9d141d'){echo'安装程序已验证';}否则{echo'安装程序已损坏';取消链接('composer-setup.php')}echo-php'

    php composer setup.php

    php-r“取消链接('composer-setup.php');”

  • 安装“用于PHP的Google API客户端库”

    php composer.phar需要google/apiclient:^2.0

  • 将适用于PHP的AdSense管理API示例复制到您的服务器

  • 修改client_secrets.json

  • 客户端ID、客户端机密和重定向URL

  • 在浏览器中打开示例。示例代码正在运行,但不起作用
  • ……T_T

  • 两周的时间里,我尝试了很多不同的方法
  • 我猜这条路是个问题。但这是错误的

    [adsense-sample.php-之前]

    /************************************************
    
      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';
    

    请帮助我…

    确保您已将adsense-sample.php文件的路径放在API管理器控制台的凭据部分。您必须添加“yoursite.com/adsense sample.php”;作为授权的重定向URI。这也必须作为URI添加到client_secrets.json中,有任何错误、警告或类似的内容吗?