Search code examples
phppostal-code

PHP - Postcode check if it's covered


I am currently developing a website for an electrical company. They would like some sort of postcode check on there. It would somehow work like this:

  1. User enters postcode
  2. See if we cover it
  3. display results.

But I have never worked with postcodes before. How would I be able to check whether they cover it. I obviously need some sort of database listing the postcode or area they cover. But how would I also check if the postcode is valid.

The postcode lookup is obviously to see if the electrical company covers the user's area.

Thanks in advance.


Solution

  • I think instead of using a database to search your results, you would be better of looking at geo location, and using a 3rd party to calculate everything for you.

    Google and Sony both provide Geo Location platforms