【发布时间】:2017-01-24 11:25:18
【问题描述】:
我无法通过Google Console api 验证网站
$client = new Google_Client();
$client->setApplicationName("MyAppName");
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setAccessType('offline');
$client->setAccessToken($token);
$verificationService = new Google_Service_SiteVerification($client);
$verificationService->webResource->get('https://domain.com');
domain.com 是我的域,也是通过 google api 添加的
我收到错误
“您不是该网站的所有者”
【问题讨论】:
-
那么您没有将正确的信息传递给 API
-
什么样的信息?有一个 $client_id 和 $client_secret
-
您不需要在站点根目录下放置一些 Google html 文件吗?
-
您是否必须在要验证的域上设置至少一种验证方法?仅使用
Google_Service_SiteVerification不会验证您是所有者,因为我可以运行$verificationService->webResource->get('https://stackoverflow.com');并声明它。 -
如何使用 google 控制台 api 在 google 上验证网站?
标签: php google-search-console google-console-developer