当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Embedded youtube link image not appearing in facebook

问题描述:

when we post youtube video link on facebook through php code, video appears on wall but video image for video does not show.what to do in this case?i am posting my code here

$facebook = new Facebook($config);

$post = $facebook->api('/me/feed','post',array(

'message' => 'Monster video',

'name' => 'Monster Video',

'description' => 'Monster University',

'caption' => 'Youtube Test Caption',

'source' => 'http://www.youtube.com/watch?v=QCjaN4XKgJw',

'picture' => 'http://img.youtube.com/vi/QCjaN4XKgJw/default.jpg',

'link' => 'http://www.youtube.com/watch?v=QCjaN4XKgJw'

));

if($post){

echo 'It\'s done!';

}else{

echo 'fail';

}

Please suggest some ways to get image appear on facebook wall.This code is helpfull in posting video and video works perfectly but video image does not appear and a blank space come over there.

网友答案:

Don't specify the source and picture parameters. Facebook will grab the image from YouTube by itself:

$facebook = new Facebook($config);
$post = $facebook->api('/me/feed','post',array(
    'message' => 'Monster video',
    'name' => 'Monster Video',
    'description' => 'Monster University',
    'caption' => 'Youtube Test Caption',
    'link' => 'http://www.youtube.com/watch?v=QCjaN4XKgJw'              
));

if($post){
    echo 'It\'s done!';
}else{
    echo 'fail';
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: