I'm building a application using PHP, HTML & JavaScript that accesses a users Facebook data and does some analysis on the information returned. It requires making approx 15 to 30 requests to the Graph API depending on how much data a user has in their profile.
I have started by ensuring that all of the data is accessible and the wait time for the scraping is not too extensive. I have used the straightforward Server-side Flow (PHP) example from the Authentication page in the Facebook documentation and have now got a bunch of PHP scripts that I am optimising. Currently I just load the page and wait for the long PHP script to execute. Not ideal.
I have realised that from a front end perspective, after the user has authenticated the FB app, there will ideally not be a page refresh and the user should not have to wait whilst the page is continually loading (i.e. waiting for the long execution of a PHP script).
Therefore my question is: should I use the same PHP scripts the I've already written and (after user authentication) set the scripts off using an AJAX request (and then use AJAX to poll for completion) or should I rewrite the server side logic in JavaScript and do the whole thing using the Facebook JavaScript SDK & AJAX?
I'm my opinion there is something about having the application reliant on the client making a ton of http requests that seems very flaky to me......plus I'd rather not rewrite everything I've already done! =)
Apologies for the long message. Trying to be as explicit as possible.
Thanks in advance, gfte