Archive for the ‘coding’ Category

Setting up a scheduled event using the WordPress “Cron” functionality

Thursday, May 7th, 2009

The function reference for wp_schedule_event provides code examples for creating a plugin using WordPress’ “Cron” or scheduling functionality.

Hopefully this saves someone the few minutes it took for me to find this – pretty much everything you need to know!

Presentation by Manuel Lemos ( on Email Deliverability

Thursday, January 29th, 2009

Had a bit of a break from posting while I have been travelling with work. Back now and so should be posting a bit more regularly.

Found this great presentation today on Slideshare by Manuel Lemos of
“Sending E-mail that reaches the destination using PHP”.

It provides a basic overview of email protocols and systems and covers best practices to ensure email gets through, including specific reference to PHP classes he wrote. The MIME Email Message Sending PHP Class is really useful.

Send SMS notifications from your Web Application

Wednesday, November 26th, 2008

A few years ago I started using Clickatell as a way to send SMS messages from different applications I built. Getting a message to notify you of particular events (“you received an order”, “something isn’t working right”) allows you to respond in a timely manner.

I have one web-based application that monitors various websites I work on and I get a downtime notification via SMS any time a site is down. I have also integrated SMS with osCommerce to send order notifications including the contents of the order. This is great for monitoring a low volume sideline store. There are lots of applications for this of course.

I have used Aleksandar Markovic’s Clickatell SMS API for a number of years. It supports CURL and fopen for the HTTP request and is very easy to integrate into your application.

Modifying WordPress Rewrite Rules – small problem + solution

Wednesday, September 3rd, 2008


I had to look at the WordPress core code to work this out – thought I was going nuts. If you apply new rewrite rules using the rewrite_rules_array filter you need to ensure that you refresh the rewrite rules that WordPress has stored in a hidden option. You do this by simply resaving the Permalink Structure under the Options menu in the admin area of your WP install.

Not immediately obvious that this would be required, but makes sense that they generate the rules and store them at this point.

Implementing Free Geolocation with PHP Using Maxmind’s GeoLite Country

Sunday, August 17th, 2008

Need to serve up different content for people from different countries? Or track users by country? Or make a site more usable by providing options relevant to a particular country? I recently had a small programming task which required pre-selection of a country field based on the visitor’s country.

Maxmind offers a free Geolocation database, GeoLite Country which allows lookup of country from an IP. They claim it to be 99.3% accurate. They have a paid version that is more accurate. They also offer other databases, including one to lookup a city from an IP. The database is available as CSV data or in binary format. The binary format is very easy to implement as they provide APIs in a variety of languages. I used their PHP API. There are code samples to get things going quickly.

I used their PHP class which was the easiest to implement. Simply upload the class file and binary file and require the class file. The calls are simple and the lookup is fast. Very easy to implement.

Amazon’s Seller Central SOAP API

Tuesday, July 15th, 2008

Very disappointing experience working with’s Seller Central APIs. Their documentation is frankly very bad. Undocumented and incorrectly documented aspects will make the curve to get this working unnecassarily steep. Their support is not responsive. The forums are not overly helpful although you can see similar issues coming up. Disappointing for such a large and groundbreaking web-based company, especially as they are looking to promote their Web Services infrastructure to developers.

The comments in this article are very accurate of my thoughts/experience implementing Amazon’s Seller Central SOAP API using PHP (they are using Java) …

My time getting to the ‘hello world’ stage on this interface was measured in days vs minutes for pretty much every other system I have worked with.

Good notes on implementing Amazon’s Seller Central SOAP API

That article should help anyone regardless of the particular language they are using to do this. It helped me with one important final aspect that was undocumented by Amazon.

For more specific notes on doing this with PHP check out the last chapter of this book …

The Web Developer’s Guide To Amazon E-Commerce Service

A couple of key things in there will overcome issues with the particular way the Amazon SOAP server works. There will still be problems – but that will get you much of the way.

Note: don’t waste your time with Amazon AIM. As the article above mentions, unless you have an old account migrated from Amazon’s Marketplace system it will only work to download reports – it will not allow adding or updating products.

Great Article on Unicode and Character Sets

Wednesday, June 18th, 2008

It is easier as a developer who deals with English 99.9% of the time to overlook this stuff – especially in PHP – until you open and try to manipulate a bunch of .txt file not even thinking about the variety of Unicode formats. Found this rather enlightening …

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

Good for any PHP coder to read, especially as the documentation on this stuff at is a bit on the lean side.

Update:Character Sets / Character Encoding Issues from WACT with lots of PHP-specific information.