How to get a bitcoin address's balance?
blockexplorer.com does show the right balance. However, you are looking up in the Testnet blockchain.

The right request is the following:
http://blockexplorer.com/address/134dV6U7gQ6wCFbfHUz2CMh6Dth72oGpgH

If you open that link, you will see that it shows the right balance.

As you have mentioned, blockexplorer.com is open source, so you probably want to look at the source code to find out how the mechanism you are interested in works.