我有一个音乐博客,想将我所有的帖子复制到 facebook,但是当我手动发布时,我无法让 api 像我一样发布流式音频。它确实发布了,但音频被删除了。这是我的代码:
<?php
require 'facebook-php-sdk/src/facebook.php';
$APP_ID = 'MYAPPID';
$APP_SECRET = 'MYAPPSECRET';
$PAGE_ID = 'MYPAGEID';
$ACCESS_TOKEN = 'GENERATEDACCESSTOKEN';
$facebook = new Facebook(array(
'appId' => $APP_ID,
'secret' => $APP_SECRET,
'cookie' => true,
));
$attachment = array(
'message' => 'some message',
'attachment' => '{"media": [{"type": "mp3","src": "http://EXAMPLE.COM/music.mp3", "title": "title", "artist": "artist", "album":"album"}]}',
'access_token' => $ACCESS_TOKEN
);
$result = $facebook->api('/'.$PAGE_ID.'/feed', 'post', $attachment);
if($result){
echo "<p>Posted status update</p>";
}
else {
echo "<p>Unable to post update.</p>";
}
?>
知道如何解决这个问题吗?谢谢大家