sudomains 上的 Google Search Console API 权限

问题描述 投票:0回答:1

美好的一天!

我在 Google Search Console 上有一系列域名:

  • 域名.eu
  • 子域名.eu
  • test.sub.domain.eu

我拥有对所有三个域属性的权限(没有协议前缀)。 我想使用 GSC API (PHP) 来抓取数据,但由于某些原因,当我尝试针对 sub.domain.eutest.sub.domain 运行请求时,收到“凭据不足”错误消息.欧盟

    Google_Service_Webmasters->searchanalytics->query($siteUrl, $query);

在错误消息中,我看到它尝试访问 http://sub.domain.eu 但我找不到强制 GSC API 使用 https 版本的方法。

有人遇到类似的问题并给我提示如何解决吗?

php permissions subdomain google-search-console google-search-api
1个回答
0
投票

显然将协议添加到站点就足够了:

    $siteUrl = "https://sub.domain.eu"

尽管如此

    $siteUrl = "domain.eu"

工作得很好

© www.soinside.com 2019 - 2024. All rights reserved.