Send batch requests to Graph API using Facebook’s PHP client
The PHPSDK provided by Facebook is quite good, though it lacks the ability to send batched requests.
The reason for sending batched requests is that it allows you to combine multiple requests into a single one.
I’ve added the functionality and submitted a pull request on GitHub, but just incase that doesn’t get merged for some reason, here’s how to do it yourself.
Modify src/base_facebook.php and add the following function
And then be a nice guy, and add a quick test to tests/tests.php
You can see the usage in the test above, but essentially all that you need to do is create a multidimensional array where each value
is an array containing the method type, and the relative url. The just call the →batch() method on the Facebook instance and parse the results.