Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何从谷歌检索我的商业评论_Php_Google My Business Api - Fatal编程技术网

Php 如何从谷歌检索我的商业评论

Php 如何从谷歌检索我的商业评论,php,google-my-business-api,Php,Google My Business Api,我可以连接到Google My Business并拨打电话返回账号,但我无法列出与该账户相关的位置,也无法检索评论 require_once( '/functions/google-api-php-client/vendor/autoload.php' ); require_once( '/functions/mybusiness/MyBusiness.php' ); $client = new Google_Client(); if ( $credentials_file = checkS

我可以连接到Google My Business并拨打电话返回账号,但我无法列出与该账户相关的位置,也无法检索评论

require_once( '/functions/google-api-php-client/vendor/autoload.php' );
require_once( '/functions/mybusiness/MyBusiness.php' );

$client = new Google_Client();

if ( $credentials_file = checkServiceAccountCredentialsFile() ) {
    // set the location manually
    $client->setAuthConfig( $credentials_file );
} elseif ( getenv( 'GOOGLE_APPLICATION_CREDENTIALS' ) ) {
    // use the application default credentials
    $client->useApplicationDefaultCredentials();
} else {
    echo missingServiceAccountDetailsWarning();

    return;
}

$client->setApplicationName( "Cardall_Orthodontics_Reviews" );
$client->setScopes( [ 'https://www.googleapis.com/auth/plus.business.manage' ] );
$service = new Google_Service_Mybusiness( $client );

$accounts     = $service->accounts;
$accountsList = $accounts->listAccounts()->getAccounts();
$account      = $accountsList[0];

$locations     = $service->accounts_locations;
$locationsList = $locations->listAccountsLocations( $account->name )->getLocations(); // This is where it's not returning the locations
$location      = $locationsList[0];

$reviews             = $service->accounts_locations_reviews;
$listReviewsResponse = $reviews->listAccountsLocationsReviews( $location->name );
$reviewsList         = $listReviewsResponse->getReviews();

当我打印$account->name时,我可以看到
accounts/000000000000000
(使用我的帐户ID),所以我只假设它一直在工作,但我不确定为什么没有任何位置。我的业务帐户中添加了一个。

您找到解决方案了吗?我也有同样的问题我也有同样的问题。Keith或@EmilioGort你找到解决方案了吗?不幸的是,我从来没有找到解决方案。