This is not exactly answering your question but I have found it to be an easier method. I use a free zipcode table from the Census I downloaded from http://federalgovernmentzipcodes.us/.
There is a CSV format, xls file and Yes a MySQL dump (The SQL code to do table create and import for you). If on your page ask for the Zip (like a lot of sites do now) instead of the City and State you are dealing with a numerical index instead of a string. You can quickly narrow the list and verify it with the user. Table includes Longitude and Latitude (great for google maps), county, and some other handy data. Table includes various city spellings however the main unique zip code record is indicated by the zprimary='Yes'. I used the data to generate a separate table with zipcode as the primary key and only the zprimary = 'Yes' records and there is really no need to verify the city/State information.
Hope this helps.