Category: PHP


A Google Webmaster Tools API PHP Example – Using Search Analytics API to download search analytics data as CSV with the new OAuth 2.0 method

This is a Webmaster Tools API PHP Example to download your search analytics data as CSV with the new OAuth 2.0 method. As you probably have learned, Google announced that they will be discontinuing their old CSV download scripts for information on queries & rankings and replacing it with their new Search Analytics API. Since there’s a… Read more »

Add batcache to your WordPress site (nginx + APC + php-fpm + batcache)

This is a continuation of my other blog post(s) – Install nginx, php-fpm, APC, MariaDB, and phpMyAdmin on CentOS 6 and How to install a web server on CentOS 7 using nginx, php-fpm, MariaDB, and firewalld. This is just a simple post about installing Batcache (the best caching plugin for WordPress IMHO) and fixing it to output the… Read more »

Generate secure URL token in PHP with a simple class

I often have to look back at previous projects that I’ve done to generate a quick token that is URL friendly so I can issue out email links with some encrypted data in them. There are plenty of crypto nerds out there that will get super crazy with their techniques and I totally support them…. Read more »

Incredibly simple WordPress session handler

Here’s a super simple session handler for WordPress. This only initializes the session (starts and stops as needed). You’ll want to add things to the $_SESSION array to your liking. Add this to functions.php:

As you can see, this has ZERO bells or whistles and is intended for the programmer to use sessions as they… Read more »

Resize images with PHP on file upload using ImageMagick to dynamically generate thumbnails and different image sizes

This is an example of a function I wrote for a client to handle image uploads and dynamically resize the original image to 500×500 and generate different image sizes (thumbnails, etc.) with PHP using ImageMagick. If you don’t have have ImageMagick installed, or are unsure if you do, you’ll want to install it first. If… Read more »