1
我有一個問題,在谷歌+找到一個網站的份額。我做了臉譜,高音等,但我不知道如何在谷歌+做到這一點。我已經搜索這個解決方案,但只有它返回0Google+分享計數錯誤
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共享計數:( –