- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
这是我在尝试运行以下 Perl 代码时收到的错误消息。任何想法是什么造成的?它似乎不喜欢 API=Verify,但它是我能找到的返回 9 位邮政编码的 API 的唯一名称。
80040B1AAPI 授权失败。不是一个有效的 API 名称协议(protocol).USPSCOM::DoAuth
# Perl subroutine for POST Request
#########
sub FindTracking() {
$saddress="60 Passional Way";
$scity="Burnsville";
$szip="27690";
$sstate="NC";
print "start of tracking...<br>";
$queryString = qq~
<?xml version="1.0"?>
https://secure.shippingapis.com/ShippingAPI.dll?API=Verify&XML=
<AddressValidateRequest USERID="xxxxxxx">
<Revision>1</Revision>
<Address ID="0">
<Address1></Address1>
<Address2>$saddress</Address2>
<City>$scity</City>
<State>$sstate</State>
<Zip5>$szip</Zip5>
<Zip4></Zip4>
</Address>
</AddressValidateRequest>
<?xml version="1.0"?>
<AddressValidateResponse><Address ID="0">
<Address2></Address2><City></City><State></State><Zip5></Zip5>
<Zip4></Zip4></Address></AddressValidateResponse>
<Error>
<Number></Number>
<Source></Source>
<Description></Description>
<HelpFile></HelpFile>
<HelpContext></HelpContext>
</Error>
~;
# Instantiate the user agent and set our agent string
$userAgent = new LWP::UserAgent;
$userAgent->agent( 'USPS' );
$queryString =~ s/ /\%20/ig;
$request = new HTTP::Request( 'POST',
'https://secure.shippingapis.com/ShippingAPI.dll' );
# Set the content type
$request->content_type( 'text/xml' );
# Set the query string
$request->content( $queryString );
# Make the request
$response = $userAgent->request( $request );
print $response->content();
# Check the status of the request
if ( $response->is_success ) {
$content = $$response{ "_content" };
$TrackingNumber = "";
($success) = $content =~ /\<AddressValidateRequest\>(.*)\
<\/AddressValidateRequest\>/;
print "<br><br>==>some $content<br>";
if ($success eq "Success") {
($TrackingNumber)= $content =~ /\<Zip4\>(.*)\<\/Zip4\>/;
print "here with $TrackingNumber<br>";
}
}
else {
print "<br><br>here with resp=$response<br>req=$request <br>cont
$content";
}
}
最佳答案
首先,您有一个无效的查询字符串。将您的操作与 USPS WebTools example 进行比较并删除他们不显示的内容。确保您正确设置了您的 USERID(而不是使用“xxxxxxx”);环境变量在那里很方便。
或者,您可以尝试使用 Business::USPS::WebTools来自 GitHub 的模块。它实现了邮政编码查找。
关于perl - USPS HTTP 邮寄请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53463740/
我有一个客户用 USPS 统一费率箱运送液体。如果您不熟悉 USPS 统一费率箱,它们是一定体积的箱子,无论重量如何都可以运输。任何适合盒子的东西,都以低价发货。我的客户使用两种尺寸的箱子:中等统一费
我需要从 USPS 获取运费。 我已经与他们签约,获得了自己的用户 ID 并尝试使用页面上显示的示例请求 XML - https://www.usps.com/webtools/htm/Rate-Ca
我希望通过 USPS 邮政区更轻松地对数百个信封进行分类。困难在于必须根据原始邮政编码为美国 8 个区域中的每一个区域手动分类:91352 . http://postcalc.usps.gov/Zon
这是我在尝试运行以下 Perl 代码时收到的错误消息。任何想法是什么造成的?它似乎不喜欢 API=Verify,但它是我能找到的返回 9 位邮政编码的 API 的唯一名称。 80040B1AAPI 授
我需要能够根据可能的美国邮政服务州缩写列表验证字符串,而 Google 没有提供任何指导。 我知道一个明显的解决方案:那就是编写一个非常大的 if(或 switch)语句来检查和比较所有 50 个状态
我想向 USPS 验证给定的地址(地址、城市、州、邮政编码),如果提供的地址是有效地址,则返回结果。如果不是有效地址,则返回无效地址。 那么我如何在 C#.Net 中执行此操作。 最佳答案 美国邮政服
我在 WooCommerce USPS 运输插件中遇到以下错误:“ USPS REQUEST FAILEDcURL error 5: Could not resolve proxy: http_pro
我正在编写一个 gem 来检测跟踪号码(称为 tracking_number ,natch)。它在文本中搜索有效的跟踪号码格式,然后按照每个服务规范中指定的校验和计算运行这些格式,以确定有效号码。 前
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
我正在尝试通过 AJAX 调用访问 USPS 地址验证 API,但出现“跨源请求已阻止”错误。 但是,当我尝试通过 URL 访问同一地址时,我得到了结果。 这个错误与批准有关吗? 我为此使用的 ID
USPS provides用于生成新的智能邮件条码的 C 库和 Java 包装器。有没有人找到 Perl 包装器?我以前用过一次 SWIG,但想看看在我遇到麻烦之前是否已经完成了。到目前为止,我的搜索
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 2年前关闭。 Improve this qu
我们正在发送地址行 1 和地址行 2 进行验证。 当它进入 USPS 进行验证时,验证后它会连接 Address Line1 中的两个地址行。 例如: AddressLine1: 20 ROOSEVE
我正在努力在产品页面上显示运费,例如在亚马逊和 eBay。 但是,因为我会比通常的购物车页面更多地调用 API,我想知道 USPS API 是否有任何限制可以阻止我在产品页面上使用 API? 你认为我
我在谷歌上搜索了很多,但未能找到美国邮政服务使用的 PDF417 条码的解码算法。我想从中获取带有跟踪号的收件人和发件人信息。 我已经成功解码了符合 ANSI MH10.8.3 标准的 FedEx 条
只是我有一个注册 USPS它提供了 US Address Validation API。我正在使用以下代码获取 XML 响应。 但是,不幸的是 Response 说: Authorization Fa
我从 USPS 收到这个错误我正在查询 http://production.shippingapis.com/ShippingAPI.dll?API=RateV4&XML= 80040b1a
我正在将 USPS 跟踪 API 集成到我当前的项目中,需要一些帮助来获取所有跟踪信息。基本上,我的请求是通过以下 URL 完成的: http://production.shippingapis.co
我正在尝试通过 USPS API 在 http://production.shippingapis.com/ShippingAPI.dll 获取国际运费报价我有用户名和帐号,可以成功使用 API 进行
USPS ZipCode 网站和 Excel VBA——我拥有所有用于填充网站的代码,但我无法单击带有 Excel-VBA 代码的“查找”提交按钮。 这是该站点的 URL 以及我提交的所有按钮单击代码
我是一名优秀的程序员,十分优秀!