/ Published in: PHP
URL: http://lucido-media.de/blog/php-google-plus-one-count-api
interesting app: http://codecanyon.net/item/socialcounter-php-class-social-statistics/282826
Expand |
Embed | Plain Text
function get_google_plus1_count($url) { $ch = curl_init(); CURLOPT_POST => true, 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"}]', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_URL => 'https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ' )); $res = curl_exec($ch); curl_close($ch); if( $res ) { $json = json_decode($res,true); return $json[0]['result']['metadata']['globalCounts']['count']; } return false; }
Comments
Subscribe to comments
You need to login to post a comment.

hello there, there's a new way to get the google plus's counts, check this link http://www.upgradedtutorials.info/php/getting-google-plus-count-using-php-curl/. the code was so handy and useful, you can also use it as much as you want. Sparky!