谷歌几天前宣布了 Blogger 帖子的“自动发布到 Google+”功能。(它会自动将博客帖子分享到 Google+ 个人资料或页面)该功能是否可用于通过 API 发布的帖子或仅来自 Blogger Web 界面的帖子?似乎它只能从界面工作,但也许我缺少范围或参数?
范围:
https://www.googleapis.com/auth/blogger
http://www.blogger.com/feeds/"
用于发布的 PHP cURL:
$postData = array(
'kind' => 'blogger#post',
'blog' => array('id' => $blogID),
'title' => $postTitle,
'content' => $postMessage
);
$ch = curl_init('https://www.googleapis.com/blogger/v3/blogs/'.$blogID.'/posts/');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer '.$authToken,
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($postData)
));