【发布时间】:2018-06-20 03:34:27
【问题描述】:
我一直在挠头,试图让 LWP 和 HTTP::Request 实际将 POST 参数传递给 Web 服务器。 Web 服务器可以看到该请求是一个 POST 事务,但它没有获取传递的参数。我整天都在搜索这个并尝试了不同的东西,但我还没有找到有效的东西。 (网络服务器正在工作,我可以手动发送事务处理,并且在运行整个脚本时,我得到“200”状态,但我没有看到任何已发布的元素。任何帮助将不胜感激。Tnx。
my $ua2 = LWP::UserAgent->new;
$ua2->agent("Mozilla/5.0 (compatible; MSIE 6.0; Windows 98)");
my $req2 = HTTP::Request->new(POST => "$url", [ frm-advSearch => 'frmadvSearch' ]);
$req2->content_type('text/html');
my $res2 = $ua2->request($req2);
$http_stat = substr($res2->status_line,0,3);
【问题讨论】:
-
substr($res2->status_line,0,3)最好写成$res2->code
标签: perl post httprequest lwp