Unable to connect to Facebook Graph API
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 开发者_JAVA技巧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...
This API 100% uses cURL, I just used it and got a cURL error.
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.
As far as I see browsing the source code, this api requires curl https://github.com/mattmecham/php-sdk/blob/master/src/facebook.php
精彩评论