Results 1 to 4 of 4
  1. #1

    Faster Json data pull

    as the title says I want to pull data from the API FASTER! I am currently trying to pull data quicker here is my sample code
    --------------------------------------------------------------
    $ ApiLink = " http: //census.soe.com/ " ;
    $json_decode = (json_decode(file_get_contents($ApiLink), true));
    $tada = $json_decode["character_list"];
    --------------------------------------------------------------

    the above information takes 2.4633 seconds to load, I want to make this happen faster... when I load the url it takes 1419 MS if you scroll to the bottom but when I view the same url it takes 2 seconds

    Any tips will be appreciated

    Thanks!

  2. #2
    Join Date
    Oct 2011
    Location
    Cary, NC (USA)
    Posts
    49
    Quote Originally Posted by icedpikachu View Post
    as the title says I want to pull data from the API FASTER! I am currently trying to pull data quicker here is my sample code
    --------------------------------------------------------------
    $ ApiLink = " http: //census.soe.com/ " ;
    $json_decode = (json_decode(file_get_contents($ApiLink), true));
    $tada = $json_decode["character_list"];
    --------------------------------------------------------------

    the above information takes 2.4633 seconds to load, I want to make this happen faster... when I load the url it takes 1419 MS if you scroll to the bottom but when I view the same url it takes 2 seconds

    Any tips will be appreciated

    Thanks!
    API response times are often dependent on the servers that are sending them. Sometimes, this is simply out of your control. Best thing to do is not load API data on the fly, but to have a cache system of some kind.
    CrankedCode.com - Professional Mobile and Web Development

  3. #3
    Is the api return data date wise? If so run cron daily and store data daily.
    The coder.

  4. #4
    Quote Originally Posted by CrankedCode View Post
    API response times are often dependent on the servers that are sending them. Sometimes, this is simply out of your control. Best thing to do is not load API data on the fly, but to have a cache system of some kind.
    I do cache most of everything in MySQL but there are a few small items which I want to be "live" just this small piece

    http: //census.soe.com/get/ps2:v2/characters_online_status/?character_id=5428029729515051201

    the api tells me how long it takes to get the info

    timing: {
    characters_online_status-ms: 13,
    total-ms: 13
    }

    but when I pull it using json_decode takes longer than the API says instead of Milliseconds it takes seconds to load

Similar Threads

  1. Replies: 0
    Last Post: 10-09-2013, 02:09 AM
  2. Want to pull data from a URL and display it using PHP/HTML
    By 2399Skillz in forum Programming Discussion
    Replies: 14
    Last Post: 11-17-2012, 10:30 PM
  3. Dynamically pull data to website from excel question
    By tinoisawesome in forum Web Hosting
    Replies: 13
    Last Post: 03-10-2012, 11:26 PM
  4. Replies: 8
    Last Post: 07-27-2004, 06:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •