A
A
AndreykaPro72017-01-19 09:29:37
Facebook
AndreykaPro7, 2017-01-19 09:29:37

How to make posts from facebook automatically added to the site?

How to make posts from facebook automatically added to the site?
site built on joomla

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Goryachev, 2017-01-19
@webirus

https://www.youtube.com/watch?v=sUA2FFpL4FA

N
Nikita, 2017-01-19
@z4d0r

$me = curl_init();
curl_setopt($me, CURLOPT_URL, "https://graph.facebook.com/v2.5/{COMMUNITY_ID}/posts/?fields=description,full_picture,message&format=json&access_token={ACCESS_TOKEN}&limit=25");
curl_setopt($me, CURLOPT_RETURNTRANSFER, true);

$curl = json_decode(curl_exec($me), true);

$data = $curl['data'];

Paste this on the page where you want to upload posts. $data stores all uploaded posts.
For example, adding further:
static $id = 0;
while ($id <= 15) {
    echo '  <h1>' . $data[$id]["message"] . '</h1>';
    $id--;
}
?>

will unload the last 15 posts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question