Question: I have a PHP script at the moment which allows users to enter a UK postcode.

I was wondering if there was a way I could get their geolocation from the postcode they enter. (Through Google's API or something?)

I have tried <http://code.google.com/apis/maps/documentation/geocoding/index.html> but it requires a full address, whereas I only have a postcode.

Help would be appreciated, thanks :)
Peter

Answer: 
There's now a free UK government alternative to the other options listed here. Go to <http://postcodes.io/> to see the details of the API and examples
Though this is already answered:
here is a link for a simple API that allows obtaining GeoJson for googlemaps..query by single or combining UK Postal Code(ex. ZE1 0AE) ,Sector, District, City, and Wards Boundaries

<https://www.mashape.com/vanitysoft/uk-boundaries-io>

[![query by uk postal](https://i.stack.imgur.com/uGF32.png)](https://i.stack.imgur.com/uGF32.png)