【问题标题】:Get Facebook Video Thumbnails Large Size using Facebook Video ID - PHP使用 Facebook 视频 ID 获取大尺寸的 Facebook 视频缩略图 - PHP
【发布时间】:2016-11-19 12:50:50
【问题描述】:
【问题讨论】:
标签:
php
facebook
facebook-graph-api
video
【解决方案1】:
我找到了如何使用缩略图高解决方案,并且我成功获得了缩略图高解决方案。您可以使用以下代码:
$video_id= Input::get('id_video');
$config = [
'app_id' => \Config::get('setting.APP_ID'),
'app_secret' => \Config::get('setting.SECRET_ID'),
'default_graph_version' => 'v2.7',
];
$fb = new Facebook($config);
$accessToken = Input::get('access_token');
$url = "https://graph.facebook.com/".$video_id."?fields=description,thumbnails&access_token=".$accessToken;
//Make the API call
$result = file_get_contents($url);
//Decode the JSON result.
$decoded = json_decode($result, true);
//Dump it out onto the page so that we can take a look at the structure of the data.
var_dump($decoded);
$accessToken 我从 Graph explorer 工具获得,或者你编写函数登录 facebook 你可以获得 access_token。
https://developers.facebook.com/docs/php/howto/example_facebook_login
希望能帮到你!
【解决方案2】:
同样,我使用图形资源管理器可以获取缩略图视频,但我无法从“https://graph.facebook.com/VIDEO_ID/picture”获取缩略图。你可以参考关注
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
$session,
'GET',
'/{video-id}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */