W
W
WebDev2015-08-10 15:34:58
Facebook
WebDev, 2015-08-10 15:34:58

Get posts from facebook?

Some time ago I wrote a script that pulls posts from Facebook. I have the url of the original facebook page, I got the user id from it ( https://graph.facebook.com/{$url}), and then, at the address https://facebook.com/feed/{user_id} I got xml with all sorts of information about the user, including his posts. A few days ago, everything stopped working, https://graph.facebook.com/{$url} started asking for a token, and the page https://facebook.com/feed/{user_id} is no more. Began to look at the documentation, and there were some questions.
As far as I understand, you can get something like this:

$result = file_get_contents('https://graph.facebook.com/v2.2/'.$facebook_user_id.'/posts/?limit=10&access_token='.$access_token);

Although I did not find such an example in the documentation, and it may be wrong. This request returns json, which seems to have posts, but something is wrong there. For example, the content of the post differs from the original, there are no pictures in it, and the picture goes in a separate field.
Also, in this query, v2.2 can be replaced with v2.4, and then some truncated version of the first is returned.
Has anyone done something similar? It's not clear from the documentation. Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question