Detect bots and spammers with Project Honey Pot

Project Honey Pot is one of my favorite services. They offer an API that allows you to pull information on an IP address. This comes in very handy when vetting traffic coming to your website. I discovered the service a few years back after realizing that I had some spammers setting up profiles full of links to their Leeroy Vitton handbags and other knock...

Read Full Article →

How to convert a string to a time

Converting a string to a timestamp is one of my favorite things about PHP. In fact when trying to decide which language to build [HolidayAPI][holidayapi] in I couldn’t find an implementation of PHP’s strtotime() that rivaled the original. The strtotime() function takes a textual string as input and then spits back a timestamp, which can then be used to generate a more human readable...

Read Full Article →

Set array pointer to a specific key or value

PHP arrays are absolutely fantastic. They hold stuff, doesn’t really matter what. The interfacing is pretty consistent and there’s a boat load of built-in array functions. What PHP lacks is the ability to set the array pointer to an arbitrary key or value. There are ways to move forward and backward in the array but not a dedicated function to set the internal pointer...

Read Full Article →

Basic page routing in PHP

Last week we talked about setting up a local development server with PHP’s built-in web server and I mentioned that we’d delve into page routing. Routing refers to taking the URI that a person was requested, let’s say /about and routing that to the appropriate code. Sure, you could just have a script named about.php and just make the .php part of the URI....

Read Full Article →

Using PHP’s built-in web server

I recently updated [HolidayAPI][holidayapi] to no longer use my PHP framework because I wanted the system to be easier for new developers to get up and running. Instead of including configuration files for Apache or nginx, I decided that I should just use the web server that’s baked right into PHP! To start up PHP’s built-in web server, from the root of your project...

Read Full Article →