Usually services like this are based on web services offered from the various couriers. You would send the weight and dimensions of the box you want to ship to their web service, and they would return a corresponding shipping price. Each couriers API would be different. I'm not sure if there are any libraries that aggregate all these services together, but I've never seen one. Since prices can change at any time, you pretty much have to use some kind of web service to access this information. That is, unless you are Amazon sized and have preexisting arrangements for pricing rates on shipping with the various couriers. Just from a quick lookup, here is some of the services that FedEx offers.