I faced this similar problem a couple of years ago. It was in PERL so I'm affraid the code won't help but I can give you the methodology we used.
1) Each product carries with it a field that specifies it's weight.
2) The country was split into zones, based on the state, with each zone having its own shipping multiplier. These multipliers started at one and went up from there to 1.75 being all the way across the country.
3) When an order is placed getting the total weight of the order was a simple mysql query.
$ids //array holding all the product ids for this person's purchase.
$sql = "SELECT sum(Weight) FROM tblProducts WHERE ID IN (" . join(",",$ids) . ");
$tWeight = return value of sql statement.
4) create a zones or states table that has each state with it's zone and the multiplier in it.
$sql = "SELECT Multiplier FROM tblZones WHERE State = $UsersState"
$x = return value of sql statement
5) set up a base shipping price/pound.
$shipping = $tWeight * $base Shipping;
6) multiply the base shipping by the zone modifier.
$shipping = $shipping * $x
hope that helps.