Answer the question
In order to leave comments, you need to log in
How to use FacebookRequest (facebook api)?
I understand with fb api, I want to make a post on the wall to myself and to the group.
in their documentation, everything is so simple and clear if you send everything with such requests:
https://developers.facebook.com/docs/php/FacebookR...
or there is a subsection publishing
https://developers.facebook.com/ docs/graph-api/usi...
it's not clear how to move on to handling these requests, tell me.
<?php
$url = 'https://www.facebook.com/dialog/oauth';
$params = array(
'client_id' => $fb_client_id,
'redirect_uri' => $fb_redirect_url,
'response_type' => 'code',
'scope' => 'email,user_birthday'
);
echo $link = '<p><a href="' . $url . '?' . urldecode(http_build_query($params)) . '">Аутентификация через Facebook</a></p>';
if (isset($_GET['code'])) {
$result = false;
$params = array(
'client_id' => $fb_client_id,
'redirect_uri' => $fb_redirect_url,
'client_secret' => $fb_client_secret,
'code' => $_GET['code']
);
$url = 'https://graph.facebook.com/oauth/access_token';
}
$tokenInfo = null;
parse_str(file_get_contents($url . '?' . http_build_query($params)), $tokenInfo);
echo $tokenInfo['access_token'].'<br>';
?>
<?php
if (count($tokenInfo) > 0 && isset($tokenInfo['access_token'])) {
$userInfo = json_decode(file_get_contents('https://graph.facebook.com/me' . '?' . urldecode(http_build_query($request))), true);
if (isset($userInfo['id'])) {
echo $userInfo['id'];
$result = true;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question