| 1 | use strict; | ||
| 2 | use feature 'say'; | ||
| 3 | use HTTP::Tiny; | ||
| 4 | |||
| 5 | my $xml = '<RateV4Request USERID="563THEGA4590" PASSWORD="415FT08PY842"><Revision>2</Revision><Package ID="AC92D646-75D8-11E5-B1F9-E7A2AA3E4BB4"><Service>all</Service><ZipOrigination>53716</ZipOrigination><ZipDestination>32309</ZipDestination><Pounds>1</Pounds><Ounces>0</Ounces><Container></Container><Size>Regular</Size><Width>6</Width><Length>12</Length><Height>12</Height><Girth>69</Girth><Machinable>False</Machinable></Package></RateV4Request>'; | ||
| 6 | |||
| 7 | |||
| 8 | my $http = HTTP::Tiny->new; | ||
| 9 | my $uri = 'http://production.shippingapis.com/ShippingAPI.dll'; | ||
| 10 | #$uri = 'http://testing.shippingapis.com/ShippingAPItest.dll'; | ||
| 11 | my $response = $http->post_form($uri, { | ||
| 12 | API => 'RateV4', | ||
| 13 | XML => $xml, | ||
| 14 | }, { | ||
| 15 | headers => { | ||
| 16 | Content_Type => 'application/x-www-form-urlencoded', | ||
| 17 | }, | ||
| 18 | }); | ||
| 19 | |||
| 20 | say $response->{content}; |