Ernest Marples PHP Helper Function

| Comments

Some of you may have seen my blog post about the Ernest Marples API a few weeks ago, and since then there’s been no slapped wrists from the Post Office and a lot of people voicing their support

There’s also been a Perl helper library courtesy of Andy Armstrong and, as Perl looks a little bit like French to me, I thought I’d get my hands dirty and build a little PHP function to add to the mix.

You can check it out and give it a test here - basically all it does is accept a postcode and then returns an array with the original postcode, together with the latitude and longitude. It’s pretty simple, but then again, the API is too, so there’s no real point adding to it.

Feel free to nick the code, and use it as you see fit. If you are using it in a live project, it’s probably a good idea to let the Ernest Marples guys know, so they can keep you up to date with the latest developments - enjoy!

Update: The wonderful Tom Graham has made a few changes to this script to utilise the cURL library, which is handy if your server doesn’t allow fopen to access external URLs. Check it out on Github.