美国邮政署 USPS 取消运单号

相关

美国邮局,也称美国邮政署(英语:United States Postal Service, USPS)或美国邮政服务,是美国联邦政府的独立机构。

美国邮政署拥有596,000名雇员,以及218,684辆汽车,是全球最庞大的民用车队。每年处理177亿信件,占全球数量的四成。美国邮政署是少数在美国宪法中提及设立的机构。2018年7月19日,《财富》世界500强排行榜发布,美国邮政位列123位。

文档:https://www.usps.com/business/web-tools-apis/evs-label-api.htm

这个没有负责的加密解密,直接传就好了

php 复制代码
<?php
// USPS API Endpoint
$apiUrl = 'https://secure.shippingapis.com/ShippingAPI.dll';

// USPS API Credentials
$userId = 'XXXXXX';
$password = 'XXXXXXX';

// Barcode Number of the original label
$barcodeNumber = '420322579200190353014500000024';

// Build the XML request payload
$xmlRequest = <<<XML
<eVSCancelRequest USERID="{$userId}" PASSWORD="{$password}">
    <BarcodeNumber>{$barcodeNumber}</BarcodeNumber>
</eVSCancelRequest>
XML;

// Build the full API request URL
$requestUrl = $apiUrl . '?API=eVSCancel&XML=' . urlencode($xmlRequest);

// Set up cURL request
$ch = curl_init($requestUrl);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Process the response
    echo 'Response: ' . $response;
}

// Close cURL session
curl_close($ch);
相关推荐
渣渣盟16 小时前
当 Redis 写入成为性能瓶颈时,如何利用 异步批量 Sink 将吞吐量从 1w QPS 提升到 10w+?
数据库·redis·php
XR12345678821 小时前
工业园区整体组网,方案对比怎么选?
开发语言·php
️学习的小王1 天前
二级MySQL PHP综合应用题完整考点+历年真题风格练习题
android·mysql·php
别动我齐刘海1 天前
Day10 unitree_G1人形机器人BVH/MocapApi实际输出少于Axis
开发语言·php
2601_965798472 天前
Is Piroll WordPress Theme Worth It for Freelancers? Full Review
数据库·php
zero_70322 天前
HCIP 课程文字版思维导图笔记
服务器·网络·php
abbgogo2 天前
OSPF动态路由协议
开发语言·php
大鱼>2 天前
共识算法:从PBFT到HotStuff的拜占庭容错演进
区块链·php·共识算法
正在走向自律2 天前
使用atop工具监控Linux系统指标
linux·运维·php·实时监控·atop分析内存
2401_894915533 天前
Geo 优化源码部署常见报错排查:连接失败、地图加载、地域词失效解决方案
服务器·开发语言·python·安全·php