Smccullough
Smccullough

Reputation: 363

Requesting multiple Facebook fanpage data in a single call

I have about 20 Facebook fanpages setup with a "Welcome/Home" app install across all of them. Is there a way to tally up all the "Likes" from these fanpages to display on my app? I've tried using the JavaScript SDK FB.api() feeding it arrays (using .toString() and .join(',')) as well as JSON objects and even direct input. It seems like Facebook can only handle one fanpage id request for data at a time. I haven't looking yet, but is there a way to do this in PHP. I feel I may run into the same situation.

Suggestions would be great!

Upvotes: 5

Views: 3309

Answers (1)

jBit
jBit

Reputation: 2981

Graph URL for Multiple Pages - https://graph.facebook.com/?ids=19292868552,11239244970

Multiple Pages Request as a Facebook JavaScript SDK Example:

FB.api(
    '/', 
    {ids : "19292868552,11239244970"}, 
    function(response) { 
        if (!response || response.error) {
            console.log(response.error); 
        } else { 
            console.log(response); 
        } 
    }
);

Multiple Pages Request as a Facebook PHP SDK Example:

$result = $facebook->api('/', 'get', array('ids' => array('19292868552','11239244970')));

Upvotes: 10

Related Questions