无法连接到Facebook Graph API

时间:2011-03-13 19:10:25

标签: php facebook-graph-api

我有以下代码。我没有收到任何错误,即使我授权申请,我的名字也不会显示。我应该说,我的主机不支持curl,所以我使用了不需要curl的api(https://github.com/mattmecham/php-sdk)

<?php

require 'src/facebook.php';
$facebook = new Facebook(array(
                'appId'  => 'my app id here',
                'secret' => 'the code that should be here...',
                'cookie' => true,
                ));

$me = $facebook->api('/the thing that follows after facebook.com/ to get to my profile');
echo $me['name']
?>

你知道问题出在哪里吗?如果您需要任何其他信息,请告诉我......

3 个答案:

答案 0 :(得分:1)

此API 100%使用cURL,我刚刚使用它并且出现了cURL错误。

答案 1 :(得分:0)

您的连接/实例化信息似乎一切正常。也许你的api电话不正确。您应该可以使用$me = $facebook->api('/me');来获取您的信息。试试看,看看你是否收到回复。

答案 2 :(得分:0)

据我所知,浏览源代码时,此api需要curl https://github.com/mattmecham/php-sdk/blob/master/src/facebook.php