L
L
Lord_Dantes2019-12-12 18:54:02
Facebook
Lord_Dantes, 2019-12-12 18:54:02

Completely “your own” Facebook feed on the site?

sorry for the tags in advance as not a master at this.
There are posts in the Facebook group, and we need to insert them into the site, but with my template.
Please tell me in what way I can get the data I need into variables, and already insert information into the template from them.

The data I need and the template

Фиолетовым - логотип группы
Желтым - название группы
Зеленым - дата поста
Белый квадрат - текст поста
Красным - текст "Читать далее"
Черный блок - картинка поста
5df2615ab0536209196119.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tynay Bakasov, 2019-12-18
@Lord_Dantes

First option
$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'];

Вставляете это на страницу , на которой необходимо выгружать посты. В $data хранятся все выгруженные посты.
К примеру, добавив дальше:
static $id = 0;
while ($id <= 15) {
    echo '  <h1>' . $data[$id]["message"] . '</h1>';
    $id--;
}
?>

будет выгружать последние 15 постов.

You can take rss pages from Facebook, here is the instruction.
And withdraw in any convenient way.
Here is a link to one script, it seems simple, you can customize the look yourself.
or you can search for scripts for displaying on the page yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question