为什么费率不适用于USPS?我正在使用ratev4,但出现错误:
错误:
API Authorization failure. RateV4 is not a valid API name for this protocol.
UspsCom::DoAuth
这是我的代码:
<?php
$devurl = "testing.shippingapis.com/ShippingAPITest.dll";
$puburl = "https://secure.shippingapis.com/ShippingAPITest.dll";
$service = "RateV4";
$userid = "690DEVBL1739";
$xml = rawurlencode('<RateV4Request USERID="xxxxx">
<Revision/>
<Package ID="1ST">
<Service>FIRST CLASS</Service>
<FirstClassMailType>LETTER</FirstClassMailType>
<ZipOrigination>44106</ZipOrigination>
<ZipDestination>20770</ZipDestination>
<Pounds>1</Pounds>
<Ounces>0.0</Ounces>
<Container/>
<Size>REGULAR</Size>
<Machinable>true</Machinable>
</Package>
</RateV4Request>');
$request = $devurl . "?API=" . $service . "&xml=" . $xml;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo "<pre>";
print_r($response);
echo "</pre>";
最佳答案
我在测试Ratev4(对于国际运输来说是v2)时遇到了相同的问题。只是要求他们轻松地将您转移到固定的产品上,但是请确保您使用正确的网址。
除此之外,据我了解,您的设置也无法正常工作,因为您要求的是头等舱的价格,重量是1磅。头等舱最多升至13盎司...