Ok, so I bet you are asking "why did he write this script and then set up a page about it?", well the answer is: I needed a way to verify the addresses of our CO's to improve our council's Unit Locator and when I mentioned this script on a couple of e-mail lists I got WAY more requests for it than I expected. :)
The Input
The steps to running this program are pretty simple. Unfortunately, I didn't actually go through the steps on ScoutNet so I'm at a bit of a loss as to how to tell you to do it. Basically you select the "Chartered / Participating Organization Listing" report in ScoutNet and then download the spooled report after it finishes (this information is NOT on the CSV file export from ScoutNet - even though, we have asked for that). When you download the file, you want to name it "CHARTER.TXT" and save it in the same directory with the script.
The Output
When you run the PHP script, it opens "CHARTER.TXT" and creates a "CHARTER.OUT" file (which you can view using WordPad or whatever text viewer you want to use). As the program runs it dumps the report to the file and to the screen. If you see "***" to the left of the CO name, that means that the USPS couldn't verify the address. The column at the right shows the units that are associated with the CO and any corrections necessary to the address. You can see an example and a little more detailed explanation of the output here.
If you see a CO more than once, that means that the CO is entered in ScoutNet more than once with DIFFERENT information (if the same CO is entered more than once with the SAME information, I can't tell it - I'm not sure if this is a problem).
The Script
Yeah, I know you didn't want to hear my life story - you came here to get the good stuff (OK, "good stuff" is WAY overstating it!). Here's the script. The function at the top of the script does the call to the USPS web site to try to lookup the address. I can't say for SURE that I wrote that part from scratch (it came out of one of my programs from a year or so ago - but I seem to remember fighting with that little bit of code for a while).
Well, that's about it. Have fun!