Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


maxxd last won the day on August 30

maxxd had the most liked content!

Community Reputation

90 Excellent

About maxxd

  • Rank
    Prolific Member

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling
  • Location
    North Carolina

Recent Profile Visitors

15,144 profile views
  1. Interesting - don't know how I've managed to avoid that issue. Thanks for the info!
  2. I have, and it was a genuine question. I guess I've just been lucky enough to have never come across a situation where the distinction has bitten me in the butt or where I've noticed, in all honesty.
  3. I don't mean to be rude, but you're going to have to do some work on your own, here. Again, I'm not writing this for you - what's the value of $lastCall? Echo it out, explore what the code's doing. If nothing else has changed in the code you posted, it doesn't matter because you don't actually use the code that I gave you.
  4. I'm sure it does, because you copied and pasted my code and then didn't use it. If you had error reporting turned on you'd be getting an error about the fact that $money doesn't actually exist. You may not know how to code, but you can obviously read. Apply some though to what you're seeing here and adapt the code that you've got with the code you've been given.
  5. This is entirely untested, but using the snippet of code you posted first and the statement that you've got a running Redis server, try this: function doSomeStuff(){ try{ $redis = new Redis(); }catch(RedisException $e){ die('Could not connect to Redis host'); } if(!$redis->connect('', 6379)){ die('Redis connection failed'); } $lastCall = $redis->get('API::CALL::LAST'); if(empty($lastCall) || microtime() - $lastCall > (5 * 60 * 1000)){ $myData = file_get_contents(''); $myObject = json_decode($myData); if(!is_null($myObject)){ $myObjectMap = $my
  6. Which is why I recommended Redis to begin with. Honestly, I kinda assumed it was a standard default in host/VPN setups (which may tell you how out of touch I am with devOps and server admin).
  7. Here are a couple links on using Redis - it's super simple. https://redislabs.com/lp/php-redis/ and https://github.com/phpredis/phpredis. Long story short, I'm not going to write your code for you. The point of this board is to help people when they get stuck with the code they're writing - I feel I've done that in this case. Take what you know and what I suggested and try to write it. If you have problems then, post the code you've written and we can all take another look. But you're not going to learn anything if I write the code for you.
  8. Pseudocode: $lastCall = Redis::get('API::CALL::LAST'); if(empty($lastCall) || microtime() - $lastCall > (5 * 60 * 1000)){ $this->apiReturn = makeApiCall(); Redis::set('API::CALL::LAST', microtime()); return $this->apiReturn; } return $this->apiReturn;
  9. I'd probably store the last time the API call was run in a Redis key, then check against it before running the next call. Honestly I'm not sure that setting a 5 minute TTL on a Redis key will delete the key after 5 minutes (I think it will, but I'm not completely sure and if it's important you shouldn't mess about with it), so it's probably safer to just create a key and update it every time the API call is made.
  10. Every time you make the call, store the time. Then compare it before you make the next call - if it's been less than 5 minutes, use the existing data. Otherwise make the call again. Or you can use Redis with a 5 minute TTL - if the index exists, use it. If not, refresh it.
  11. That kinda depends on the third-party's API. If you make the call in Postman does it take a minute? Honestly, the fact that the load time increases each time you submit the page makes me think it's the PHP, but I haven't looked that closely at your code.
  12. Again, ajax has absolutely nothing to do with curl. If you're missing information between pages 1 and 4, you need to set the information in either a session or cookie variable, or pass it between the pages in another way. Of use local storage in JavaScript. You also mention 'simulating' a click to pages2, 3, and 4 - I'm not sure what you mean by that. Do you physically click a link or button on a page that sends you to a new page, or does something else happen? On a side note - @kicken, I don't recall having heard of fiddler before. I'm gonna explore that 'cause it looks pretty cool; than
  13. Please post the code in question here (and please use the '<>' button to format your code), as well as explaining exactly what '4 pages deep' means. If I'm understanding correctly, there's nothing inherently special about a 'https://tld.com/page1/page2/page3/page4' curl call that would cause an ajax error. And now that I type that, ajax and curl are completely different things so perhaps posting the JavaScript ajax code along with the relevant PHP would help.
  14. Don't get me wrong - I didn't parse your entire XML string because it's hella long. However, from the description you gave I'd start here.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.