Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4078612
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:41:46+00:00 2026-05-20T17:41:46+00:00

I am calling Facebook API to retrieve my fan page’s like count on my

  • 0

I am calling Facebook API to retrieve my fan page’s like count on my WordPress blog. It is working fine (I retrieved the XML and parsed it with file_get_contents.) Now the problem is that the API is called at every page load and to also file_get_contents() is rather slow a method. I want to call the API only once per hour and keep the data in cache to reduce load times.

I don’t know hot to go about it? Is that even possible? Help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:41:47+00:00Added an answer on May 20, 2026 at 5:41 pm

    It’s a little low-tech but storing the “likes” with a timestamp in a text file should do the trick. Something like this should work (PHP5):

    $store = 'likes.txt'; // make sure this file exists, empty is fine to start with
    
    list($likes, $stamp) = explode('|', file_get_contents($store));
    
    if ((time() - $stamp) > 3600){
        // use your own page's name here instead of "php"
        $fbook = json_decode(file_get_contents("https://graph.facebook.com/php"));
        $likes = $fbook->{'likes'};
        file_put_contents($store, "$likes|".time());
    }
    
    echo $likes;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am calling the FaceBook API like this: -(IBAction)testBtnAct:(id)sender{ [facebookObj requestWithGraphPath:@me andDelegate:self]; } -(IBAction)test1BtnAct:(id)sender{
I am calling the Facebook Add Page Tab Dialog using the Javascript SDK as
I am calling com.facebook.graph.Facebook.init(APP_ID, loginHandler); to log in to facebook using the actionscript api
My sample Facebook app was working great yesterday in Chrome. The page integrates Silverlight
I'm currently calling the Facebook graph API from one of my actions which returns
Using the Facebook C# API release version from 12/20/2011, I'm calling the facebook client
I'm using the new facebook graph API and getting an odd error when I
I'm trying to use the new Facebook Graph API on my website. This is
I'm using Facebook API v5.3 BETA, although have tried the following using v5.2.1 Stable.
I'm looking to optimize my application. It uses the Twitter and the Facebook API

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.