Google AdWords APIを CakePHPから呼び出して実行しようとしていますが、Classの扱いがよく分かっておらず、エラーが出ています。
対応の方法をご教授いただけませんでしょうか?
Account Performance Report
https://developers.google.com/adwords/api/docs/appendix/reports/account-performance-report
上記のものを実行するため、APIを下記の場所に設置しました。
/app/Vendor/adwords-examples-33.0.0/examples/AdWords/v201710/Reporting/
そして、
/app/Vendor/adwords-examples-33.0.0/
の場所で、下記のコマンドを実行して APIの動作を確認しました。
php examples/AdWords/v201710/Reporting/DownloadCriteriaReportWithSelector.php
「DownloadCriteriaReportWithSelector.php」を多少カスタマイズしていますが、基本構造はそのままで、この状態では想定しているレポートのデータを取得できています。
「DownloadCriteriaReportWithSelector.php」のソースファイルは、下記にあるものです。
https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201710/Reporting/DownloadCriteriaReportWithSelector.php
これを、下記のような流れの CakePHPのシェルで実行しようとしています。
php
1<?php 2App::uses('ComponentCollection', 'Controller'); 3App::import('Vendor', 'adwords-examples-33.0.0/examples/AdWords/v201710/Reporting/DownloadCriteriaReportWithSelector'); 4 5class GoogleReportShell extends Shell { 6 7 (中略) 8 9 public function google_ad() { 10 //レポートクラス読み込み 11 $ReportDownload = new DownloadCriteriaReportWithSelector; 12 13 $file_name = $ReportDownload->DownloadCriteriaReportWithSelector->main(); 14 15 (略) 16
PHP Fatal error: Class 'DownloadCriteriaReportWithSelector' not found in /home/app/Console/Command/GoogleReportShell.php on line 1663
というエラーがでます。
エラーの行数は、「$ReportDownload = new DownloadCriteriaReportWithSelector;」の行です。
「DownloadCriteriaReportWithSelector.php」を置いてある場所は、「App::import('Vendor',....」で指定しているパスで合っていると思っていますので、そもそも呼び出し方が違っているのではないか、と思っています。
回答1件
あなたの回答
tips
プレビュー