美国邮政署 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);
相关推荐
车载测试工程师6 小时前
车载以太网网络测试-29【SOME/IP-SD】-SD状态机
网络·网络协议·tcp/ip·车载系统·php
还鮟15 小时前
CTF Web PHP弱类型与进制绕过(过滤)
php·ctf
zorro_z15 小时前
PHP语法基础篇(八):超全局变量
php
九分源码1 天前
基于PHP+MySQL组合开发开源问答网站平台源码系统 源码开源可二次开发 含完整的搭建指南
mysql·开源·php
RainSerein1 天前
Laravel8中使用phpword生成word文档
word·php·laravel
pltrue1 天前
Go 重构案例分享:订单创建逻辑重构
go·php
RainSerein1 天前
Laravel8中调取腾讯云文字识别OCR
ocr·php·腾讯云·laravel
杰哥技术分享1 天前
PHP Yii2 安装SQL Server扩展-MAC M4 Pro芯片
开发语言·php
wuk99811 天前
深入理解PHP中的生成器(Generators)
开发语言·php
A5资源网11 天前
为WordPress 网站创建一个纯文本网站地图(Sitemap)
前端·数据仓库·html·php