我正在使用我的开发人员凭据进行FedEx Web服务,使用RocketShipIt API,它只是一个XML包装器。
问题是label_img变量一直是空的:
以下是我使用的示例代码:
$shipment = new \RocketShipIt\Shipment('fedex');
$shipment->setParameter('service', 'FEDEX_2_DAY');
$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toName', 'John Doe');
$shipment->setParameter('toPhone', '1234567891');
$shipment->setParameter('toAddr1', '111 W Legion');
$shipment->setParameter('toCity', 'Whitehall');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59759');
$shipment->setParameter('toCountry', 'US');
$shipment->setParameter('packagingType', 'FEDEX_ENVELOPE');
$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('weight','0.1');
$response = $shipment->submitShipment();
echo "<pre>";
print_r($response);
echo "<pre>";
我得到了回应:
Array
(
[status] => SUCCESS
[charges] => 17.61
[trk_main] => 794663231443
[tracking_detail] => Array
(
[id] => 794663231443
[type] => FEDEX
)
[pkgs] => Array
(
[0] => Array
(
[pkg_trk_num] => 794663231443
[label_fmt] => PNG
[label_img] =>
[cod_return_label_img] =>
)
)
)
我搜索了所有的FedEx和RocketShipIt文档,没有任何运气。我不知道为什么我的label_img为空。也许是因为我使用的是开发者凭证?但是,开发人员测试凭证的想法被滥用了。