我的 notify.php 中有这个
foreach ($request['userActions'] as $i => $user_action) {
if ($user_action['type'] == 'SHARE') {
write("SHARE");
$timeline_item_id = $request['itemId'];
$timeline_item = $mirror_service->timeline->get($timeline_item_id);
foreach($timeline_item->getAttachments() as $j => $attachment) {
write(json_encode($attachment));
$attachment = $mirror_service->timeline_attachments->get($timeline_item_id, $attachment.getId());
$bytes = download_attachment($timeline_item_id, $attachment);
// Insert a new timeline card, with a copy of that photo attached
$echo_timeline_item = new Google_TimelineItem();
$echo_timeline_item->setText("Echoing your shared photo");
$echo_timeline_item->setNotification(
new google_NotificationConfig(array("level"=>"DEFAULT")));
insert_timeline_item($mirror_service, $echo_timeline_item, "image/jpeg", $bytes);
write("ECHO");
}
break;
}
}
问题是它说
$attachment = $mirror_service->timeline_attachments->get($timeline_item_id, $attachment.getId());
找不到“.getId()”。
我也有所有必需的文件
require_once 'config.php';
require_once 'mirror-client.php';
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_MirrorService.php';
require_once 'util.php';
有任何想法吗?