Google + php API でたくさんの瞬間を挿入しました。これらは私のコードです。
$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_ecret);
$client->setRedirectUri($redirect_uri);
$requestVisibleActions = array(
'http://schemas.google.com/AddActivity',
'http://schemas.google.com/ReviewActivity',
'http://schemas.google.com/CreateActivity');
$client->setRequestVisibleActions($requestVisibleActions);
$plus = new Google_PlusService($client);
if (isset($_GET['code'])) {
//https://www.googleapis.com/auth/userinfo.email
$client->authenticate($_GET['code']);
}
if ($client->getAccessToken()) {
$moment_body = new Google_Moment();
$moment_body->setType("http://schemas.google.com/CreateActivity");
$item_scope = new Google_ItemScope();
Zend_Log::INFO);
$item_scope->setId('1343');
$item_scope->setType("http://schemas.google.com/CreateActivity");
$item_scope->setType("http://schema.org/CreativeWork");
$item_scope->setName("Test");
$item_scope->setDescription(“This is just a test.”);
$moment_body->setTarget($item_scope);
$momentResult = $plus->moments->insert('me', 'vault', $moment_body);
応答は次のとおりです。
array(5) { ["kind"]=> string(11) "plus#moment" ["type"]=> string(40) "http://schemas.google.com/CreateActivity" ["target"]=> array(4) { ["kind"]=> string(14) "plus#itemScope" ["id"]=> string(4) "1343" ["description"]=> string(20) "This is just a test." ["name"]=> string(4) "Test" } ["result"]=> array(1) { ["kind"]=> string(14) "plus#itemScope" } ["id"]=> string(75) "Eg0xMzc1NTE2ODc2MDYzGJGDxrC2ufClwgEyAhABQgYYofONXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }
モーメントの投稿に成功したようです。右?
そして問題は、それをどこで見ることができるかです。Google Plusにログインしています。挿れた瞬間しか見えなかった。なんで?