英文:
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);
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论