我正在制作一个将一些 XML 发布到另一台服务器的脚本,但我遇到了加号 (+) 的问题。这是我的代码:
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
my $XML = qq|
<?xml version="1.0" encoding="UTF-8"?>
<ServiceAddRQ>
<Service code="Ws%2BsuHG7Xqk01RaIxm2L/w1L">
<ContractList>
<Contract>
<Name>CGW-TODOSB2B</Name>
</Contract>
</ContractList>
</Service>
</ServiceAddRQ>
|;
utf8::encode($XML);
my $ua = LWP::UserAgent->new;
$ua->timeout(120);
my $ret = HTTP::Request->new('POST', $XMLurl);
$ret->content_type('application/x-www-form-urlencoded');
$ret->content("xml_request=$XML");
my $response = $ua->request($ret);
正如您在属性代码中看到的,值字符串具有 %2B,而另一台服务器接收值“Ws+suHG7Xqk01RaIxm2L/w1L”。
我如何发送 %2B 文字。
提前致谢
韦尔奇