美国邮政署 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);
相关推荐
郑州光合科技余经理10 小时前
海外外卖平台源码改造实战——多语言核心代码实现
java·开发语言·前端·后端·mysql·架构·php
娇气的红酒14 小时前
微软对PHP支持的改进,及其它一些胡言乱语
开发语言·microsoft·php
2601_9637713714 小时前
Scaling Podcast RSS Feeds and Audio Streaming on WordPress Servers
前端·windows·php
wbs_scy14 小时前
仿 muduo 高并发服务器项目:实现轻量级日志宏,方便后续网络库调试
开发语言·php
万联WANFLOW1 天前
多分支企业组网,IP 网段到底该怎么规划
开发语言·php
WZF-Sang1 天前
网络基础——2
服务器·网络·c++·学习·网络编程·php
行思理1 天前
fastadmin 新手部分功能点
后端·php
用户3074596982071 天前
# GatewayWorker 入门指南
php
2601_963771372 天前
Optimizing Logistics and Transportation Sites on WordPress
前端·数据库·windows·php
草邦设计开发团队_媒体资源平台2 天前
Linux 稳定常驻启动 PHP 队列,服务器重启自动恢复
linux·服务器·php·队列执行