you would need to set a session to determine residential or not:
$_SESSION['addressType'] = "1";
for residential
or:
$_SESSION['addressType'] = "0";
for commercial
then change that code to:
$UPS_XML .= "<PostalCode>".$UPS_Parameters["ShiptoZip"]."</PostalCode><CountryCode>".$UPS_Parameters["ShiptoCountry"]."</CountryCode><ResidentialAddressIndicator>".$_SESSION['addressType']."</ResidentialAddressIndicator></Address></ShipTo><Service><Code>".$UPS_Parameters["CarrierCode"]."</Code></Service>";