首页 > 解决方案 > 如何使用 Google My Business PHP 库更新现有位置?

问题描述

我连接和提取现有位置信息没有问题,但更新现有位置数据没有成功。

你们如何更新商店营业时间?

# library: https://github.com/spotonlive/php-google-my-business

# client and scope
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setSubject("my@emailaddres.ca");
$client->addScope("https://www.googleapis.com/auth/plus.business.manage");

# service
$mybusinessService = new Google_Service_Mybusiness($client);

// Get locations
$account_name = "accounts/ACCOUNTNUMBERHERE";
$locations = $mybusinessService->accounts_locations;
$locations_list = $locations->listAccountsLocations($account_name)->getLocations();

// update website
$locations_list[0]->setWebsiteUrl("https://www.newwebsitehere.com");

标签: phpclientgoogle-my-business

解决方案


推荐阅读