Skip to content

Latest commit

 

History

History
28 lines (25 loc) · 1.13 KB

README.md

File metadata and controls

28 lines (25 loc) · 1.13 KB

Address validation and auto-comlete using UPS API for PHP 5.5 >=

The tool allows to work with UPS address validation tool through the SOAP, realizing operations of validation and auto-complete addresses. Contains two methods:

  • validate_address - to validate an address or get a list of possible address candidates;
  • get_address_field_candidates - to get a list of possible candidates for a specific field (like state, zip or address).

Before work you need to initialize the tool with your credentials:

    /**
     * Setup API credentials
     */
    public function set_credentials()
    {
        $this->user_name = '';          // TODO initialize credentials from your storage.
        $this->password = '';
        $this->license_number = '';
    }

After that it is ready to work. Below are sample of auto-completing a field 'address':

try {
    $output = $ups_connector->get_address_field_candidates('US', $zip, $state, $city, $street, $type);
} catch (Exception $e) {
    echo 'ERROR: ' . $e->getMessage();
    die;
}