【问题标题】:Google+ share count errorGoogle+ 分享计数错误
【发布时间】:2013-07-16 22:10:48
【问题描述】:

我在 google+ 中查找网站的共享计数时遇到问题。我已经完成了 facebook、tweeter 等,但我无法弄清楚如何在 google+ 中进行操作。我已经搜索过这个解决方案,但它只返回 0。

function get_plusones($url) {
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . $url . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
 $curl_results = curl_exec ($curl);
 curl_close ($curl);
 $json = json_decode($curl_results, true);
 return intval( $json[0]['result']['metadata']['globalCounts']['count'] ); 

}

我做错了什么?有什么解决办法吗?

【问题讨论】:

  • 现在 google+ 不返回 URL 共享计数 :(

标签: google-api share google-plus


【解决方案1】:

发现解决方案没有把www放在url前面。

【讨论】:

  • 解决方法是你需要输入准确的URL。有些网站有www,有些没有。
猜你喜欢
  • 1970-01-01
  • 2015-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多