Finding Messages Using Facebook Graph Api

I want to search for posts (news feed) using the graphical API for the last 30 days of data? What is the best practice? And does the Facebook API have an API restriction for restricting HTTP request requests?

+3
source share
6 answers

NOTE. None of the below work. Starting with version 2.3 of the Facebook API, the search endpoint is out of date.

Copy from here to the "Search" section :

Search

You can search all publicly accessible objects in a social graph from https://graph.facebook.com/search . format:

https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE

:

* All public posts: https://graph.facebook.com/search?q=watermelon&type=post
* People: https://graph.facebook.com/search?q=mark&type=user
* Pages: https://graph.facebook.com/search?q=platform&type=page
* Events: https://graph.facebook.com/search?q=conference&type=event
* Groups: https://graph.facebook.com/search?q=programming&type=group
* Places: https://graph.facebook.com/search?q=coffee&type=place&center=37.76,122.427&distance=1000
* Checkins: https://graph.facebook.com/search?type=checkin

, , q :

* News Feed: https://graph.facebook.com/me/home?q=facebook

. FQL, JavaScript SDK, fb.dataquery method. , , .

, , , PHP Javascript. , , ( json_decode) json, URL:

https://graph.facebook.com/[USERNAME/USERID]?fields=posts&access_token=[A VALID ACCESS TOKEN]

, . docs .

+8

- PHP file_get_contents URL.

cURL ; , JSON, json_decode, .

facebook :

$feedurl = "https://graph.facebook.com/$user_id/feed?access_token=$valid_access_token";
$feed = file_get_contents($feedurl);
$feed = json_decode($feed);
foreach ($feed->data as $post){
     //process each post
}

, , ; facebook API . https://developers.facebook.com/docs/reference/api/

+3

Graph API

, 30 . ( 30 , .. 30 * 24 * 60 * 60 , strtotime)

, API, Facebook, :

~ (5M MAU): 5 ,

~ (100M API )

~ (50 ).

0

17 2016 FQL ...

, Facebook SDK/API, .

0

URL- ( php sdk), , json, , .

<fb:login-button perms='read_stream' autologoutlink='true'></fb:login-button>

, api

$name=json_decode(file_get_contents('https://graph.facebook.com/USERID/feed?access_token='.Your ACCESS TOKEN));

, .

USERID
YOUR ACCESS TOKEN
.
-1

You can use this call with an access token from the diagram explorer, where the number is page ID:

123123123123123?fields=posts.limit(5)
-1
source

Source: https://habr.com/ru/post/1789611/


All Articles