Google have recently depreciated the Google +1 count feature that was once a flagship feature of the platform. If you're interested in retrieving the count for any of your pages, the following function continues to work... although access can't be relied upon.
At the time of writing it's a little unclear how the +1 features will continue to work from within the platform.
1
<?php
2
/*
3
Google Plus One Count With PHP
4
http://www.beliefmedia.com/code/php-snippets/google-plus-one
5
*/
6
7
function beliefmedia_get_plusones($url) {
8
9
10
curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
11
curl_setopt($curl, CURLOPT_POST, 1);
12
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"}]');
13
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
14
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
15
16
curl_close ($curl);
17
18
19
20
21
}
22
23
/* Usage */
24
$url = 'http://www.internoetics.com/2012/05/16/count-shares-to-facebook-twitter-linkedin-googleplus/';
25
echo beliefmedia_get_plusones($url);