Skip to content

Instantly share code, notes, and snippets.

@shin1x1
Created July 27, 2011 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shin1x1/1109232 to your computer and use it in GitHub Desktop.
Save shin1x1/1109232 to your computer and use it in GitHub Desktop.
php.googleplusapi sample
<?php
require_once('lib/GooglePlus/GoogleUtil.php');
define('GPLUS_ID', 'GOOGLE PLUS ID'); // Google+ ID を入れる
$url = 'https://plus.google.com/_/profiles/get/'.GPLUS_ID;
//$ret = GoogleUtil::FetchGoogleJSON($url);
$ret = json_decode(GoogleUtil::CleanGoogleJSON(file_get_contents($url)));
$posts = $ret[1][4][0];
foreach ($posts as $post) {
//var_dump($post);exit;
// 3: 名前
// 4: 本文(HTMLタグ)
// 73.16: +1
// 21: permlink
// 25: share(0:氏名、1:gplusId)
// 47: share時コメント
echo 'name='.$post[3].PHP_EOL;
echo 'share post='.$post[47].PHP_EOL;
echo 'post='.$post[4].PHP_EOL;
echo '+1='.$post[73][16].PHP_EOL;
echo 'share='.count($post[25]).PHP_EOL;
echo PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment