kingdm,
You will want to know that Google's TOS does not allow for this type of functionality.
That being said -- you have a few options.
- Purchase a Zip/Post(al) code database (usually $250 for US/Canada both, much less for just US)
If you choose this option - they often provide you with PHP code for calculating the "as the crow flys" distance calculation.
- Using Google Maps API
Google Maps API does allow you to output XML (KML, actually)
The service will return an XML formatted document..
See This Link as an example.
Be sure to read google's TOS to ensure you can do what you wish to do with it.
They provide source code examples in Javascript to parse the data.
If you use PHP, you can merely parse the XML to take the distance between two points, and store it in your database.
Best of luck..