-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.php
More file actions
61 lines (51 loc) · 1.33 KB
/
example.php
File metadata and controls
61 lines (51 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
// Example Code
EasyPost::setApiKey("cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi");
$address = array('street1' => '388 Townsend St',
'street2' => 'Apt 20',
'city' => 'San Francisco',
'state' => 'CA',
'zip' => '94107');
echo "<p>";
$response = EasyPost_Address::verify($address);
echo $response['address'];
echo "</p>";
$rates = array(
'parcel' => array(
'predefined_package' => 'SmallFlatRateBox',
'weight' => 10.0
),
'to' => array(
'name' => 'Reed Rothchild',
'street1' => '101 California St',
'street2' => 'Suite 1290',
'city' => 'San Francisco',
'state' => 'CA',
'zip' => '94111'
),
'from' => array(
'name' => 'Dirk Diggler',
'phone' => '3108085243',
'street1' => '300 Granelli Ave',
'city' => 'Half Moon Bay',
'state' => 'CA',
'zip' => '94019'
),
'carrier' => 'USPS',
'service' => 'Priority'
);
echo "<p>";
$response = EasyPost_Postage::rates($rates);
echo $response['rates'];
echo "</p>";
echo "<p>";
$response = EasyPost_Postage::buy($rates);
echo $response['rate'];
echo "</p>";
echo "<p>";
echo EasyPost_Postage::get("test.png");
echo "</p>";
echo "<p>";
echo EasyPost_Postage::listAll();
echo "</p>";
?>