Skip to content

Commit ee38bef

Browse files
authored
Add files via upload
1 parent def1cce commit ee38bef

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

demo/validate-address-by-array.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use RahulGodiyal\PhpUpsApiWrapper\AddressValidation;
4+
5+
require_once('./vendor/autoload.php');
6+
7+
$client_id = "xxxxxxxxxxxxxxxx"; // UPS Client ID
8+
$client_secret = "xxxxxxxxxxxxxxx"; // UPS Client Secret
9+
10+
// Address to be validated
11+
$address = [
12+
"AddressLine" => [
13+
"785 GODDARD CT"
14+
],
15+
"PoliticalDivision2" => "ALPHARATTA",
16+
"PoliticalDivision1" => "CA",
17+
"PostcodePrimaryLow" => "30005",
18+
"CountryCode" => "US"
19+
];
20+
21+
echo '<pre>';
22+
print_r(AddressValidation::setAddress($address)->validate($client_id, $client_secret)); // For Dev Api
23+
print_r(AddressValidation::setAddress($address)->setMode('PROD')->validate($client_id, $client_secret)); // For Prod Api
24+
echo '</pre>';
25+
die();

0 commit comments

Comments
 (0)