Google Business API PHP Get placeID for unverified locations
one text
I have no problem retrieving locationID for verified locations, but when I deal with unverified locations the locationID is null. Is there another way that I can get the locationID?
$mybusinessService = new Google_Service_Mybusiness($client);
$accounts = $mybusinessService->accounts;
$accountsList = $accounts->listAccounts()->getAccounts();
$locationStatistics = [];
//
foreach ($accountsList as $accKey => $account) {
$locations = $mybusinessService->accounts_locations;
$locationsList = $locations->listAccountsLocations($account->name)->getLocations();
if (empty($locationsList)===false) {
foreach ($locationsList as $locKey => $location) {
$reviewLink = $location['placeId'];
}
}
}
Result for unverified location:
["locationKey"]=>object(Google_Service_MyBusiness_LocationKey)#372 (7) { ["internal_gapi_mappings":protected]=> array(0) { } ["explicitNoPlaceId"]=> NULL ["placeId"]=> NULL}
Result Verified Location:
["locationKey"]=> object(Google_Service_MyBusiness_LocationKey)#45 (7) { ["internal_gapi_mappings":protected]=> array(0) { } ["explicitNoPlaceId"]=> NULL ["placeId"]=> string(27) "ChIJyetw1a7R1IkR58z78IgXWQE" ["plusPageId"]=> NULL}
Source