Hello, I would like to consume the Facebook API in HP. I would like it to let me enter a Facebook page as such. I am new and I need to consume it either in PHP or in C#, the truth is that the code is taken, so I get an error. of
require_once(src/Facebook/autoload.php): failed to open stream on line 2, I hope you can help me, Thanks!
<? php require_once 'src/Facebook/autoload.php';
$fb = new Facebook\Facebook([
'app_id' => '{id}',
'app_secret' => '{contraseña}',
'default_graph_version' => 'v2.2',
]);
try {
// Requires the "read_stream" permission
$response = $fb->get('/me/feed?fields=id,message&limit=5');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
// Page 1
$feedEdge = $response->getGraphEdge();
foreach ($feedEdge as $status) {
var_dump($status->asArray());
}
// Page 2 (next 5 results)
$nextFeed = $fb->next($feedEdge);
foreach ($nextFeed as $status) {
var_dump($status->asArray());
}
?>
Did you successfully install composer? if so, where you have your code, in the root folder there must be the vendor folder and from there you can consume the API