1
我已经下载代码&从“https://github.com/VinceG/USPS-php-api”为USPS-php-api创建演示。错误 - USPS地址验证PHP API
我有错误这样的“阵列()布尔(真)错误:没有URL集!”
请让我知道如果您有任何解决方案。
我已经使用下面的代码。
<?php
require_once('../USPSAddressVerify.php');
$verify = new USPSAddressVerify('xxxxxxxxxxxx'); // I have used correct username
$address = new USPSAddress;
$address->setFirmName('Apartment');
$address->setApt('100');
$address->setAddress('9200 Milliken Ave');
$address->setCity('Rancho Cucomonga');
$address->setState('CA');
$address->setZip5(91730);
$address->setZip4('');
$verify->addAddress($address);
print_r($verify->verify());
print_r($verify->getArrayResponse());
var_dump($verify->isError());
if($verify->isSuccess()) {
echo 'Done';
} else {
echo 'Error: ' . $verify->getErrorMessage();
}
什么是在USPSAddressVerify.php中设置的网址? – 2013-04-29 05:04:47
请注意作者在GitHub上的公开问题,其中应该发布解决方案:https://github.com/VinceG/USPS-php-api/issues/5 – Matt 2013-04-29 05:10:11
我能够通过注释掉#行来重新创建错误# ''$ opts [CURLOPT_URL] = self :: $ testMode? self :: TEST_API_URL:self :: LIVE_API_URL;'USPSBase.php'中。确保你正在设置'$ opts [CURLOPT_URL]'。 – Sean 2013-04-29 06:06:43