- Postcode verification
- Posted by Paul Morrison on February 18th, 2006
Hi guys,
Is there any way that I can check that a postcode submitted by a user is in
fact a valid postcode, rather than just a made up one? Ive seen some sites
do this, but cant find any info on it after Googling. Any pointers in the
right direction would be great.
Cheers,
Paul
- Posted by Mark Goodge on February 18th, 2006
On Sat, 18 Feb 2006 18:21:33 -0000, Paul Morrison put finger to
keyboard and typed:
There's no algorithm (other than for the format, which doesn't really
tell you anything - XX11 1XX is a valid form, but not a valid code),
you'd have to check it against a list of known postcodes. And you
can't get a full list of valid codes without spending money on it, and
keep spending money on it to keep it up to date.
Alternatively, you could write an API for something like Google Maps
which does a postcode lookup. Provided you can do it in such a way as
to stay within the terms of use, that is - which is likely to be
somewhat more problematic :-)
Mark
--
Visit: http://www.MineOfUseless.info - everything you never needed to know!
Listen: http://www.goodge.go.uk/files/dweeb.mp3 - you'll love it!
- Posted by Gordon Hudson on February 18th, 2006
"Mark Goodge" <usenet@listmail.good-stuff.co.uk> wrote in message
news:reqev19sgkhn7vuruoomi27pbcgkbs59ck@news.marks house.net...
It gets much more complicated if you have people in different countries
filling out the form.
With that scenario you have a lot of different formats to cover.
--
Gordon Hudson || Hostroute.com Ltd
e-mail:ghudson [at] hostroute.net
http://www.hostroute.co.uk/resellers Host 5 web sites for £9 per month
http://www.nameroute.co.uk/ Domain Names with free hosting and email
http://www.myqth.co.uk/ 3000MB of web space for £29 per year
- Posted by answers@barryhunter.co.uk on February 18th, 2006
You can in fact download the list of valid UK postcodes from:
http://www.geopostcode.com/ukpc2ttn.htm
look for the 'DOWNLOAD THE FULL POSTCODES LIST WITH NEAR 1.9 MILLION
RECORDS' link.
However before some get excited its only the codes themselves you get,
no other information, such as town or location.
(you can also use this php to quickly check the postcode format before
doing a database lookup:
preg_match("/^([A-Z]{1,2}[0-9]{1,2}[A-Z]{0,1})[
\+\.]*([0-9][A-Z]{2})$/", strtoupper($p))
For checking a good range of counties (other than UK), then this:
http://www.geonames.org/export/free-geocoding.html
offers a geocoding service. Even if you don't use the returned location
it would at least tell you if its a valid postcode.
- Posted by Stevie D on February 21st, 2006
Paul Morrison wrote:
Unless you have to restrict users to those based in the UK only, this
is a very bad idea.
It is a fairly bad idea anyway.
If there is any chance of legitimate overseas users, requiring them to
enter a valid UK postcode is going to cause problems.
But at the end of the day, how difficult do you think it is to give a
fake postcode? Not in the slightest! I could give you loads of genuine
postcodes without even trying. The fact that they're nothing to do
with me is neither here nor there. What are you trying to achieve by
doing this check?
--
Stevie D
\\\\\ ///// Bringing dating agencies to the
\\\\\\\__X__/////// common hedgehog since 2001 - "HedgeHugs"
___\\\\\\\'/ \'///////_____________________________________________
- Posted by Dave (from the UK) on February 21st, 2006
Gordon Hudson wrote:
Which is the way I like it, since I can fill it some stupid postcode in
Outer Mongolia whenever some site asks for my postcode and I don't wish
to give it.
--
Dave K
Minefield Consultant and Solitaire Expert (MCSE).
Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@domain. Hitting reply will work
for a couple of months only. Later set it manually.
- Posted by Dave (from the UK) on February 21st, 2006
Paul Morrison wrote:
I hope not!
Would it not be better to have a page like this:
Please enter your postcode:
[ ]
[x] Sorry, I would rather not divulge my postcode.
I suspect your reasons for just making up an email address (as you have
done) are not too different from the reasons people make up postcodes.
I can't help feeling if people make up postcodes on your site, your
reasons for requesting them are not particularly valid. If people want
something posted to them, or to verify credit card details, they will
enter a valid postcode. If they are making them up, you should not be
asking for them, since you don't need them.
--
Dave K
Minefield Consultant and Solitaire Expert (MCSE).
Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@domain. Hitting reply will work
for a couple of months only. Later set it manually.
- Posted by Paul Morrison on February 21st, 2006
Hi,
Basically I am creating a website which has details on injustices and gives
users the chance to sign petitions, create letters from templates to send to
MPs etc and the person that I am making the site for wants there to be some
kind of postcode check to try to make it so that users cannot sign up with
bogus emails. i have tried telling him exactly the same thing that you have
said, that people do not want to divulge this information and that it is
easy to find another postcode, but he is adamant that it be in place. He now
says that to get round the problem of users from different countries, there
will only be a postcode check if the user states that they are from the UK.
As you say in a previous post, the easiest way round this one is to select a
different country.
If only I could make this guy see sense and realise that its not a good
idea!
Paul
- Posted by Paul Morrison on February 21st, 2006
Hi Stevie D,
As I have just posted below, I am making a site for someone which holds
details on injustices and give users the option to sign petitions and send
letters via the site. The guy I am making the site for wants to make the
site credible by not having people sign petitions with fake postcodes.
He now suggests that there is only verification of postcodes for users from
the UK, and then and non-UK users cannot sign petitions related to other
countries than their own.
If you want the address of the site just ask and I shall email the link
directly to you.
Paul
- Posted by Krustov on February 21st, 2006
<uk.net.web.authoring , Paul Morrison , pm42@kent.ac.uk>
<dtg0e5$d84$1@oheron.kent.ac.uk>
<Tue, 21 Feb 2006 21:24:30 -0000>
Why should anybody care one way or the other what somebody outside the
uk does or doesnt think .
Wouldnt a verify the petition signature by some sort of email
confirmation link be better ..... blocking all the most common @hotmail
/ @yahoo / etc email addresses from signing the petition .
--
(c) The Amazing Krustov


