美国邮政署 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);
相关推荐
Q_Q5110082851 天前
python+django/flask+vue的书城图书阅读器系统,亮点含目录章节pycharm
spring boot·python·django·flask·node.js·php
计算机科学与技术学习中1 天前
文件上传漏洞
php
emma羊羊1 天前
【PHP反序列化】css夺旗赛
开发语言·网络安全·php
Q_Q5110082851 天前
python+django/flask的图书馆管理系统vue
spring boot·python·django·flask·node.js·php
Q_Q5110082851 天前
python+django/flask的美食交流宣传系统vue
spring boot·python·pycharm·django·flask·node.js·php
m0_495562782 天前
Swift的逃逸闭包
服务器·php·swift
Elastic 中国社区官方博客2 天前
Observability:适用于 PHP 的 OpenTelemetry:EDOT PHP 加入 OpenTelemetry 项目
大数据·开发语言·人工智能·elasticsearch·搜索引擎·全文检索·php
catchadmin2 天前
用 LaraDumps 高效调试 PHP 和 Laravel
php·laravel
刘恒1234567892 天前
PHP中对于(并发/并行)相关概念
php
思茂信息2 天前
CST License(Flexnet)设置与问题处理方法
服务器·网络·单片机·3d·php·1024程序员节·cst