美国邮政署 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);
相关推荐
ljh57464911916 小时前
PHP password_verify() 函数
开发语言·php
Kyln.Wu19 小时前
【python实用小脚本-139】Python 在线图片批量下载器:requests+PIL 一键保存网络图像
数据库·python·php
zorro_z1 天前
PHP语法高级篇(二):文件处理
php
SuperherRo1 天前
Web攻防-PHP反序列化&原生内置类&Exception类&SoapClient类&SimpleXMLElement
php·xss·反序列化·exception·ssrf·原生类·soapclient
阿维的博客日记1 天前
TCP和UDP区别
tcp/ip·udp·php
MZ_ZXD0011 天前
flask校园学科竞赛管理系统-计算机毕业设计源码12876
java·spring boot·python·spring·django·flask·php
Q_Q19632884751 天前
python的平安驾校管理系统
开发语言·spring boot·python·django·flask·node.js·php
是阿建吖!2 天前
【Linux | 网络】应用层
linux·网络·php
夏至春来-美美2 天前
php绘图添加水印,文字使用imagick库的操作
php
果子⌂2 天前
Docker高级管理
开发语言·docker·云计算·php