我正在尝试从特定相册中获取所有图片(始终使用相同的硬编码 ID).我正在使用 Facebook 的 Graph API PHP SDK.这是我的代码:
Hi I'm trying to grab all pictures from a specific album (always the same hardcoded id). I'm using the Graph API PHP SDK from Facebook. This is my code:
<?php
require 'phpfiles/facebook.php';
$facebook = new Facebook(array(
'appId' => 'aaaa',
'secret' => 'bbbb',
'cookie' => true
));
$user_profile = $facebook->api('/1881235503185/photos?access_token=cccc');
var_dump($user_profile);
var_dump 输出:
The var_dump output:
array(1) { ["data"]=> array(0) { } }
当我使用 Javascript SDK 时它工作正常...
When I use the Javascript SDK it works fine...
FB.api('/1881235503185/photos?access_token=cccc', function(response) {
alert(response.data[0].name);
});
输出:投入产出
我是不是忘记了什么?
我明白了!它应该是:<罢工>
I got it! It should be:
$user_profile = $facebook->api('/1881235503185/photos', array('access_token' => 'cccc'));
使用新的 Facebook PHP SDK 应该是:
With the new Facebook PHP SDK it should be:
$albumjson = $facebook->api('/1881235503185?fields=photos');
这篇关于使用 Graph API PHP SDK 获取特定 Facebook 相册中的所有图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 SELECT(MYSQL/PHP) 中加入 2 个表Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 个表)
如何使<option selected=“selected">由How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 设置?)
使用 PHP 中的数组自动填充选择框Auto populate a select box using an array in PHP(使用 PHP 中的数组自动填充选择框)
PHP SQL SELECT where like search item with multiple wordsPHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(),名称 ASCMySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名称 ASC)