构建 Facebook 视频应用程序。用户可以通过在应用程序og.like中使用来收藏视频。
我用
$response = $facebook->api(
'me/og.likes',
'GET'
我会得到
"data": {
"object": {
"id": "1399918593560042",
"url": "http://some_url.com",
"type": "video.tv_show",
"title": "the_video_title"
}
获取我使用的网址。
$response = $facebook->api(
'me/og.likes?app_id_filter=381977341837631',
'GET'
);
foreach ( $response['data'] as $data );
$Object = $data['data']['object'];
然后
<li class="program"><a class="thumbnail" data-transition="slide" href="<?php echo $Object['url']; ?>">
<img src="IMG_URL"></a></li>
问题是显示图像。如果我点击图形 API 中的 ID,我将得到
{
"id": "1399918593560042",
"url": "http://some_url.com",
"type": "video.tv_show",
"title": "the_video_title",
"image": [
{
"url": "https://v.redli.se/p/102/sp/10200/thumbnail/entry_id/0_53lzx39w/width/1024/height/720",
"secure_url": "https://v.redli.se/p/102/sp/10200/thumbnail/entry_id/0_53lzx39w/width/1024/height/720",
"type": "image/jpg",
"width": 1024,
"height": 576
}
我的问题是。如何显示图像?
最佳答案
获得$Object
后,向该对象发出\GET
请求-
$resp = $facebook->api($Object['id']);
然后从响应中获取图像网址-
if(isset($resp['image']))
{
foreach ($resp['image'] as $image)
{
echo $imag_url = $image['url'];
}
}
关于php - 从 Graph API 显示 [图像][url],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18078346/