Facebook api is very slow

I am trying to make an application by getting all birthdays and other information from you facebook friends using php sdk facebook.

I get a list of friends and with the foreach cycle, I get all the information for each friend.

It all works, it only takes 4 minutes + to get all the information. (for each friend I have to make a new call)

I can’t expect users of my application to wait so long.

Is there a way to get information faster.

this is my code:


    //$arrFriends is a list with all id and names of friends

foreach ($arrFriends as $f => $value)
            {
                echo('
');
                $fql = "select uid, email, name, hometown_location, sex, birthday, education, relationship_status, pic_square from user where uid=" . $value[id];
                $param = array('method' => 'fql.query','query' => $fql,'callback' => '');
                $friend = $facebook->api($param);
                //dan opslaan in de database:
                print_r($friend);
                echo('
'); }
+3
source share
3 answers

you can use

SELECT uid, name, pic_square FROM user WHERE uid = me()
OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

Link: https://developers.facebook.com/docs/reference/fql/

The same, fast, fast, elegant solution. Let the work be with you.


( )

, , . API Facebook hudres .

facebook ( ) , , , .

OR FQL.

$fql = "select [...] from user where uid=123213312 OR uid=129038823 OR uid=893423890

FQL , . .

+5

fql HTTP- facebook, , , .

, , , , .

+1

If you do not want to use FQL, batch queries are designed specifically for this purpose. You create an array of graph requests and send them together. According to the documentation, they are processed in parallel.

+1
source

All Articles