This is for a search facility on a website. I have it all working using the standard Google Maps geocoder, but for some strange reason it seems to search only on the first part of a postcode.
It can be done in client-side JS using GlocalSearch. However, it isn't clear how to translate this into a server-side solution.
Here is a simplified version of what I have at the moment:
<?php
$requestURL = "http://maps.google.co.uk/maps/geo?output=csv&key=$apiKey&gl=uk&q="
. urlencode($_GET['pc']);
echo file_get_contents($requestURL);
?>
(Put your API key in to test.) Try, for example, DE1 2PQ and DE1 3NF. Exact same coordinates reported for both.
Any ideas?