无法连接到 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']
?>
你知道问题可能出在哪里吗?如果您需要任何其他信息,请告诉我...
I have the following code. I'm not getting any errors and my name won't display, even though I authorised the application. I should probably say, that my host doesn't support curl, so I used the api that doesn't need curl (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']
?>
Do you know where the problem might be? Please let me know if you need any additional info...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个API 100%使用cURL,我刚刚使用它并得到了cURL错误。
This API 100% uses cURL, I just used it and got a cURL error.
您的连接/实例化信息似乎一切正常。也许你的api调用不正确。您应该能够使用
$me = $facebook->api('/me');
获取您的信息。尝试一下,看看是否得到回应。Everything seems right with your connection/instantiation info. Perhaps your api call is incorrect. You should be able to use
$me = $facebook->api('/me');
to get your info. Try that and see if you get a response.据我浏览源代码来看,这个api需要curl https ://github.com/mattmecham/php-sdk/blob/master/src/facebook.php
As far as I see browsing the source code, this api requires curl https://github.com/mattmecham/php-sdk/blob/master/src/facebook.php