这是目前可用于 WP eCommerce 的唯一方式:
我不知道有任何 WP 插件除了从 UPS 获取运费之外做任何事情 - 你必须让某人为你编写自定义插件,该插件还可以生成运输摘要并将其提交给 UPS 以获得运输标签。
这里有一些你可以开始制作这样一个插件的代码
$xmlRequest1='<?xml version="1.0" encoding="ISO-8859-1"?>
<AccessRequest>
<AccessLicenseNumber>ACCESS LICENCE NUMBER</AccessLicenseNumber>
<UserId>UPS USERNAME</UserId>
<Password>UPS PASSWORD</Password>
</AccessRequest>
<?xml version="1.0" encoding="ISO-8859-1"?>
<ShipmentAcceptRequest>
<Request>
<TransactionReference>
<CustomerContext>Customer Comment</CustomerContext>
</TransactionReference>
<RequestAction>ShipAccept</RequestAction>
<RequestOption>1</RequestOption>
</Request>
<ShipmentDigest>SHIPMENT DIGEST</ShipmentDigest>
</ShipmentAcceptRequest>
';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://wwwcie.ups.com/ups.app/xml/ShipAccept");
// uncomment the next line if you get curl error 60: error setting certificate verify locations
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// uncommenting the next line is most likely not necessary in case of error 60
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3600);
//if ($this->logfile) {
// error_log("UPS REQUEST: " . $xmlRequest . "\n", 3, $this->logfile);
//}
$xmlResponse = curl_exec ($ch); // SHIP ACCEPT RESPONSE
//echo curl_errno($ch);
$xml = $xmlResponse;
preg_match_all( "/\<ShipmentAcceptResponse\>(.*?)\<\/ShipmentAcceptResponse\>/s",
$xml, $bookblocks );
foreach( $bookblocks[1] as $block )
{
preg_match_all( "/\<GraphicImage\>(.*?)\<\/GraphicImage\>/",
$block, $author ); // GET LABEL
preg_match_all( "/\<TrackingNumber\>(.*?)\<\/TrackingNumber\>/",
$block, $tracking ); // GET TRACKING NUMBER
//echo( $author[1][0]."\n" );
}
echo '<img src="data:image/gif;base64,'. $author[1][0]. '"/>';
代码来源:http ://webcollage.wordpress.com/2011/05/13/ups-label-print-with-php/
在这里http://webcollage.wordpress.com/2011/05/10/ups-shipping-confirmation-code-in-php/ 你会发现运输摘要的样子