使用easypost的dhl电子商务运营商。使用他们的官方php sdk。无法创建清单,因为我无法购买没有费率的货件。
类型:EasyPost\错误消息:未找到费率。
文件名:G:\xampp56\htdocs\shoppina\application\libraries\easypost-php-master\lib\EasyPost\Shipment.php 行号:287 回溯:文件:G:\xampp56\htdocs\shoppina\application\controllers\Home .php 行:5896 功能:lowest_rate
文件:G:\xampp56\htdocs\shoppina\index.php 行:309 功能:require_once
function easy_dummy()
{
$api_key = $this->crud_model->get_easypost_api_key("production");
$carrier_account_id = $this->crud_model->get_easypost_dhl_ecommerce_carrier_account_id();
/*$carrier_account = \EasyPost\CarrierAccount::retrieve($carrier_account_id);
echo "<pre>";
print_r($carrier_account);
echo "</pre>";*/
\EasyPost\EasyPost::setApiKey($api_key);
/*$my_carrier_accounts = \EasyPost\CarrierAccount::all();
echo "<pre>";
print_r($my_carrier_accounts);
echo "</pre>";die();*/
$to_address = \EasyPost\Address::create(
array(
"name" => "Dr. Steve Brule",
"street1" => "179 N Harbor Dr",
"city" => "Redondo Beach",
"state" => "CA",
"zip" => "90277",
"phone" => "310-808-5243"
)
);
$from_address = \EasyPost\Address::create(
array(
"company" => "EasyPost",
"street1" => "118 2nd Street",
"street2" => "4th Floor",
"city" => "San Francisco",
"state" => "CA",
"zip" => "94105",
"phone" => "415-456-7890"
)
);
$parcel = \EasyPost\Parcel::create(
array(
"predefined_package" => "LargeFlatRateBox",
"weight" => 1.0
)
);
$shipment = \EasyPost\Shipment::create(
array(
"to_address" => $to_address,
"from_address" => $from_address,
"parcel" => $parcel
)
);
//$shipment->buy(array('rate' => 100));
//$shipment->insure(array('amount' => 100));
$rates = $shipment->get_rates();
/*echo "<pre>";
print_r($rates);
echo "</pre>";
echo "<br><hr><br>";*/
/*$shipment->buy(array(
'rate' => $shipment->lowest_rate(),
'insurance' => 249.99
));*/
/* echo "<pre>";
print_r($shipment);
echo "</pre>";
echo "<br><hr><br>";*/
$my_carrier_accounts = \EasyPost\CarrierAccount::all();
echo "<pre>";
print_r($my_carrier_accounts);
echo "</pre>";
echo "<br><hr><br>";
$shipment->buy(array("rate" => $shipment->lowest_rate('dhlecommerce')));
if ($shipment) {
$batch = \EasyPost\Batch::create(array(
'shipments' => array($shipment->values)
));
/*echo "<pre>";
print_r($batch);
echo "</pre>";
echo "<br><hr><br>";*/
$batch->label(array('file_format' => 'png'));
$batch->create_scan_form();
}
// $shipment->postage_label->label_url;
}