php - Making $facebook->api to load faster and post to album to upload faster? -
i have following code. everytime load page, takes 3-5 seconds if there no user_id information. can reduce time make load faster?
$user_id = $facebook->getuser(); if ($user_id) { echo "have user"; try { $user_profile = $facebook->api('/me','get'); } catch (facebookapiexception $e) { error_log($e); $user_id = null; } $_session['facebook']= $_session; $_session['user_profile'] = $user_profile; } else { echo "no user"; $loginurl = $facebook->getloginurl( array( 'scope' => 'publish_stream, user_likes' ) ); echo "<script type='text/javascript'>top.location.href = '$loginurl'; </script>"; }
i have following code post images user album. takes 4-8 seconds before echo "success". way make faster?
//session start $user_profile = $_session['user_profile']; $user_id = $user_profile['id']; // wall post. $msg_new = "hello"; $link = "xxxxyyyy"; $facebook->setfileuploadsupport(true); $imgurl = "user_img/".$user_id.".jpg"; $args = array('message' => $msg_new.$link); $args['image'] = '@' . realpath($imgurl); $facebook->api('/me/photos', 'post', $args); $result = "success"; echo $result;
fyi: i'm testing on localhost.
fyi: i'm testing on localhost.
then requests delayed (comparatively) slow internet connection, competing other requests machine handling @ same time (music streaming, p2p, â¦), etc.
i wouldnât worry that, , see how behaves once put on ârealâ web server, has better connection home machine. if itâs still slow on there, then itâd time further investigation of matter.
Comments
Post a Comment