美国邮政署 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);
相关推荐
冠希陈、36 分钟前
PHP 判断是否是移动端,更新鸿蒙系统
android·开发语言·php
AI逐月3 小时前
tmux 常用命令总结:从入门到稳定使用的一篇实战博客
linux·服务器·ssh·php
学***54234 小时前
如何轻松避免网络负载过大
开发语言·网络·php
darkb1rd6 小时前
二、PHP 5.4-7.4版本演进与安全改进
安全·php·webshell
程序 代码狂人7 小时前
CentOS7初始化配置操作
linux·运维·开发语言·php
m0_748233177 小时前
PHP版本演进:从7.x到8.x全解析
java·开发语言·php
zhengfei6118 小时前
精选的优秀法证分析工具和资源列表
开发语言·php
REDcker8 小时前
RFC1918私有IP地址空间详解
网络协议·tcp/ip·php
云云只是个程序马喽10 小时前
AI短剧创作系统源码(PHP+MySQL+Uniapp)实现方案
php
Godspeed Zhao1 天前
现代智能汽车系统——总线技术1
网络·汽车·php