0
I have to do a job where I have to create a code that captures friends/post/likes and shares a page on facebook and stores it in the database, but I have to do this with more than one page. I have an example that started working for a specific page. But now it’s not working out, even though I’m renewing the token, could anyone help? Code below:
<html>
<head></head>
<body>
<?php
$url = "146659712053598";
$token="Aqui_Fica_o_Token"
// Faz a requisição para API do Facebook
$postagens = file("https://graph.facebook.com/".$url."/posts?access_token=".$token);
$amigos = file("https://graph.facebook.com/".$url."/friends? access_token=".$token);
$curtidas= file("https://graph.facebook.com/".$url."/likes?access_token=".$token);
// Decodifica o retorno em JSON
$json = json_decode($retorno, false);
// Retorna o Número de Likes
echo $postagens[0];
echo"<br>";
//echo $amigos[0];
echo $curtidas[0];
?>
</body>
</html>
Thank you Felipe, helped and very much, my code was very ruinzinho, kkk I will study better your code. Vlw even! ;)
– OMaths
Opa, hehe, imagine, there is no bad or good! It is that Curl allows much greater freedom! Vote on the answer if it was the most suitable, thank you!
– Felipe Douradinho
Felipe, just a little question, if I want to access who liked or shared a certain post as I do?
– OMaths
Whom
compartilhou
has no way (the face does not provide), but who liked is only accessgetPage("https://graph.facebook.com/<ID_DO_POST>?access_token=".$token);
, will see various keys and information about the post, one of them is the['likes']
and['comments']
– Felipe Douradinho