src/Beaudierman/Ups/Ups.php
public function getQuote($credentials, $options)
	{
		// Load the credentials
		$this->loadCredentials($credentials);

		// Run the options array through the default check
		$options = $this->checkDefaults($options);

		$residential_flag = ($this->commercial_rates) ? '' : '<ResidentialAddressIndicator/>';

		$negotiated_flag = ($this->negotiated_rates) ? '<RateInformation><NegotiatedRatesIndicator/></RateInformation>' : '';

		$this->xml = '<?xml version="1.0"?>
		<AccessRequest xml:lang="en-US">
			<AccessLicenseNumber>' . $this->access_key . '</AccessLicenseNumber>
			<UserId>' . $this->username . '</UserId>
			<Password>' . $this->password . '</Password>
		</AccessRequest>
		<?xml version="1.0"?>
		<RatingServiceSelectionRequest xml:lang="en-US">
			<Request>
				<TransactionReference>
					<CustomerContext>Rate Request</CustomerContext>
					<XpciVersion>1.0001</XpciVersion>
				</TransactionReference>
				<RequestAction>Rate</RequestAction>
				<RequestOption>' . $options['request_option'] . '</RequestOption>
			</Request>
			<PickupType>
				<Code>01</Code>
			</PickupType>
			<Shipment>
				<Shipper>
					<ShipperNumber>' . $this->account_number . '</ShipperNumber>
					<Address>
						<PostalCode>' . $options['from_zip'] . '</PostalCode>
						<StateProvinceCode>' . $options['from_state'] . '</StateProvinceCode>
						<CountryCode>' . $options['from_country'] . '</CountryCode>
					</Address>
				</Shipper>
				<ShipTo>
					<Address>
						<PostalCode>' . $options['to_zip'] . '</PostalCode>
						<StateProvinceCode>' . $options['to_state'] . '</StateProvinceCode>
						<CountryCode>' . $options['to_country'] . '</CountryCode>
						' . $residential_flag .'
					</Address>
				</ShipTo>
				<Service>
					<Code>' . $options['service_type'] . '</Code>
					<Description>Package</Description>
				</Service>
				<ShipmentServiceOptions/>
				' . $this->buildPackages($options['packages'], $options['weight'], $options['measurement']) . $negotiated_flag . '
			</Shipment>
		</RatingServiceSelectionRequest>';

		return $this->send();
	}
public function getQuote($credentials, $options)
	{
		// Load the credentials
		$this->loadCredentials($credentials);

		// Run the options array through the default check
		$options = $this->checkDefaults($options);

		$residential_flag = ($this->commercial_rates) ? '' : '<ResidentialAddressIndicator/>';

		$negotiated_flag = ($this->negotiated_rates) ? '<RateInformation><NegotiatedRatesIndicator/></RateInformation>' : '';

		$this->xml = '<?xml version="1.0"?>
		<AccessRequest xml:lang="en-US">
			<AccessLicenseNumber>' . $this->access_key . '</AccessLicenseNumber>
			<UserId>' . $this->username . '</UserId>
			<Password>' . $this->password . '</Password>
		</AccessRequest>
		<?xml version="1.0"?>
		<RatingServiceSelectionRequest xml:lang="en-US">
			<Request>
				<TransactionReference>
					<CustomerContext>Rate Request</CustomerContext>
					<XpciVersion>1.0001</XpciVersion>
				</TransactionReference>
				<RequestAction>Rate</RequestAction>
				<RequestOption>' . $options['request_option'] . '</RequestOption>
			</Request>
			<PickupType>
				<Code>01</Code>
			</PickupType>
			<Shipment>
				<Shipper>
					<ShipperNumber>' . $this->account_number . '</ShipperNumber>
					<Address>
						<PostalCode>' . $options['from_zip'] . '</PostalCode>
						<StateProvinceCode>' . $options['from_state'] . '</StateProvinceCode>
						<CountryCode>' . $options['from_country'] . '</CountryCode>
					</Address>
				</Shipper>
				<ShipTo>
					<Address>
						<PostalCode>' . $options['to_zip'] . '</PostalCode>
						<StateProvinceCode>' . $options['to_state'] . '</StateProvinceCode>
						<CountryCode>' . $options['to_country'] . '</CountryCode>
						' . $residential_flag .'
					</Address>
				</ShipTo>
				<Service>
					<Code>' . $options['service_type'] . '</Code>
					<Description>Package</Description>
				</Service>
				<ShipmentServiceOptions/>
				' . $this->buildPackages($options['packages'], $options['weight'], $options['measurement']) . $negotiated_flag . '
			</Shipment>
		</RatingServiceSelectionRequest>';

		return $this->send();
	}
Send an XML request to the UPS API and return
an array containing all available shipping
options with rates

@param credentials array
@param options array

@return array