Post
Topic
Board Project Development
Re: Easy Wordpress Bitcoin Price Widget Using PHP Script
by
michaelsuede
on 16/02/2012, 15:31:09 UTC
I would cache this result with a timeout of a minute or so. You might even make it do an AJAX callback so your page loads faster.

Caching is needed because if you get visitors more often than every 10 seconds, then MtGox might start throttling/blocking you.

You need to do it asynchronously so that every page load doesn't have to talk to MtGox's server before delivering the final page to the user.

That's a good idea, but more work than I'm willing to put into it at the moment.

I suppose we can just leave this "as is" for low to medium traffic blogs, but it is worth noting that high traffic sites should cache these results.

If someone updates the code snippet to cache against a MySQL database, I'll update the OP to include install instructions and the relevant code.  Ideally this code should be wrapped in its own Wordpress widget and the MySQL script to setup the database cache should be set to install automatically with the install of the Widget from inside Wordpress, with the return variables from Mt. Gox being accessible by short code in the widget text field.  This way people who have no technical knowledge would still be able to easily install the script.

It might be worthwhile to not even limit the short code variable results to a widget, but rather make them accessible from anywhere on the site, such as in headers, footers or post content.