Update for Geocoding Google maps using Maps API V3

I’ve recently updated the geocoding system posted previously (many years ago) to work better with the latest google maps API (V3).  The previous post worked fine until fairly recently then something changes.  This new method is more OO based and relies on a class for geocoding which you can call at any point you like.

Much easier to use, less code, more reuseable and work 100% with latest google API 🙂


class geocoder{
        static private $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=";

        static public function getLocation($address){
            $url = self::$url.$address;

            $resp_json = self::curl_file_get_contents($url);
            $resp = json_decode($resp_json, true);

                return $resp['results'][0]['geometry']['location'];
                return false;

        static private function curl_file_get_contents($URL){
            $c = curl_init();
            curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($c, CURLOPT_URL, $URL);
            $contents = curl_exec($c);

            if ($contents) return $contents;
                else return FALSE;


Now to use it

include "system/geocode.class.php";
$address = urlencode(trim($incoming_address));
$loc = geocoder::getLocation($address);
echo "Lat: ".$loc->["lat"];
echo "<br />";
echo "Long: ".$loc->["lng"];

Small Basic Opensource Jobboard

A while ago a friend asked if I could knock together a very basic job board for him just to post 4-5 roles he was currently recruiting for.

Being the good friend I am I agreed and 10 minutes later he had his job board.

It recently came about that others may find such a thing useful as well.  To this end I’m posting the Job Board zip file to this blog. Feel free to download it and use it if you want.  There is no license attached to this so do with it what you will.

Word of warning though to those of you that may be expecting an all singing and dancing system – this isn’t it! this is very basic and very simple and served its purpose.  There is no support with these files.


Good Luck