Google PostMaster服务与PHP

huangapple go评论75阅读模式
英文:

Google PostMaster Service with PHP

问题

我是谷歌服务的新手。我正在尝试设置和使用Gmail Postmaster Tools API

https://developers.google.com/gmail/postmaster/reference/rest

我可以在 PostMan 中使用它,但我想在 PHP 中使用它。所以我已经设置了客户端,使用类似下面的代码:

$service = new \Google\Service\PostmasterTools($client);
$results = $service->domains->listDomains();

它可以正常工作,并为我提供了域名列表。但我不知道如何获取该域的流量统计信息。

https://developers.google.com/gmail/postmaster/reference/rest/v1/domains.trafficStats/get

我已经搜索了很多,但没有找到任何关于在 PHP 中使用 PostMaster 工具的教程或示例。

如果这里有任何专家能帮助我,就请告诉我。

谢谢!

英文:

I am new to Google Sevices.I am trying to setup and use
Gmail Postmaster Tools API

https://developers.google.com/gmail/postmaster/reference/rest

I am able to use it with PostMan but I want use it with PHP. So I have setup client and using something like this

$service = new \Google\Service\PostmasterTools($client);
$results = $service->domains->listDomains();

Its working fine and providing me domain list. but I do not have idea how I can get trafficStats for the domain

https://developers.google.com/gmail/postmaster/reference/rest/v1/domains.trafficStats/get

I have searched lot but not found any tutorial or example related PostMaster tool in PHP.

Let me know if any expert here can help me for the same.

Thanks!

答案1

得分: 0

刚刚偶然看到这个,发现没有回答——你可能已经解决了,但你可以遍历$results并调用listDomainsTrafficStats()函数。

例如:

foreach($results->domains as $domain){
  $stats = $service->domains_trafficStats->listDomainsTrafficStats($domain->name);
}
英文:

Just randomly came across this and see it's unanswered -- you probably figured it out by now but you could iterate over $results and call listDomainsTrafficStats()

ex)

foreach($results->domains as $domain){
  $stats = $service->domains_trafficStats->listDomainsTrafficStats($domain->name);
}

huangapple
  • 本文由 发表于 2023年3月31日 21:49:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75899299.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定