|
Posted by laredotornado@zipmail.com on 11/27/07 21:55
Hi,
I just downloaded class.usps.php by Adam Globus-Hoenich. Sadly, I'm
getting some errors on the default test case. I've changed nothing in
the test and only filled in the dummy values for the test example.
Here's my code and the warnings and empty output follow. Any ideas
what I'm missing or what is wrong with the supplied code?
===Code from test case =====
require "class.usps.php";
$usps = new USPS("username", "password", "Verify");
$package = array(
'address1' => '',
'address2' => '8 Wildwood Drive',
'city' => 'Old Lyme',
'state' => 'CT',
'zip5' => '06371',
'zip4' => '',
);
if(!$usps->add_package($package)) die("Failed to add the package");
$usps->submit_request();
$err = $usps->get_package_error();
if ($err) {
echo "<pre>";print_r($err);echo "</pre>";
} else {
$arr['a1'] = $usps->get_address1();
$arr['a2'] = $usps->get_address2();
$arr['zip4'] = $usps->get_zip4();
$arr['zip5'] = $usps->get_zip5();
$arr['city'] = $usps->get_city();
$arr['state'] = $usps->get_state();
echo "<pre>";print_r($arr);echo "</pre>";
}
echo "end";
====Output====
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 473
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 443
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 448
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 468
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 463
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 453
Notice: Undefined offset: 0 in /usr/local/apache2/htdocs/dhlovelife/v2/
class.usps.php on line 458
Array
(
[a1] =>
[a2] =>
[zip4] =>
[zip5] =>
[city] =>
[state] =>
)
end
Thanks, - Dave
[Back to original message]
|