Iam developing a php facebook application that will display the facebook score of the facebook user depends on the count of friends, videos, subscribires, uploaded photos, his/her status comments, liked pages and links.
As you know we haveto take this data from different api url so, i wrote a php code like this
if($user){
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo "err0";
$user = null;
}
try{
$user_freinds = $facebook->api('/me/friends');
} catch (FacebookApiException $e) {
echo "err1";
$user = null;
}
try{
$user_subscribers = $facebook->api('/me/subscribers');
} catch (FacebookApiException $e) {
echo "err2";
$user = null;
}
try{
$user_links = $facebook->api('/me/links');
} catch (FacebookApiException $e) {
echo "err3";
$user = null;
}
try{
$user_foto = $facebook->api('/me/albums');
} catch (FacebookApiException $e) {
echo "err4";
$user = null;
}
try{
$user_likes = $facebook->api('/me/likes');
} catch (FacebookApiException $e) {
echo "err5";
$user = null;
}
try{
$user_videos = $facebook->api('/me/videos/uploaded');
} catch (FacebookApiException $e) {
echo "err6";
$user = null;
}
try{
$user_statues = $facebook->api('/me/statuses');
} catch (FacebookApiException $e) {
echo "err7";
$user = null;
}
}
but unfortunatley this made my application working more slow , there is any recommendation from you to make it run more quick
You are calling the API many times in a row. This might take a while and you certainly are not able to speed up the calls. Here are a few tips for you: