Facebook Post Page with Laravel 9
juliencap opened this issue · comments
Hello, thanks for the repo :)
I try to implement on Laravel 9.5 (and FPS v0.2) but on Facebook page
Before, I had a working code with "facebook/graph-sdk": "^5.6" (php 7.4)
Inside my function, I have:
`$fb = new \JanuSoftware\Facebook\Facebook ([
'app_id' => '',
'app_secret' => '',
'default_graph_version' => 'v15.0',
'default_access_token' => '',
]);
$linkData = [
'link' => $slug_fb, //get dynamic data
'message' => $post_fb, //get dynamic data
];
$pageAccessToken = '';
try {
$response = $fb->post('/me/feed', $linkData);
} catch (\JanuSoftware\Facebook\Exception\ResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch (\JanuSoftware\Facebook\Exception\SDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();`
But no more success or log message after that. If anyone can help me 🙏
You need accessToken. I don't see that in your snippet.
Hello and thanks :)
Yes, I filled default_access_token after default_graph_version and only pass $response = $fb->post('/me/feed', $linkData);
according to this comment on initial post:
// If you provided a 'default_access_token', the '{access-token}' is optional.
I also tried with access-token specified two times.
But thanks I will continue on searchs !
I used a different solution, so I close here :)
Thanks for the latest reply