perl - 使用代理发布参数(perl)

标签 perl sockets post

我要发送参数(phd => text , go => submit)使用 http 代理。我怎样才能做到这一点?

我有这个 Perl 代码:

my $ua = LWP::UserAgent->new();
my $req = POST 'http://example.com',
[ phd => 'text' , go => 'submit'];
$content = $ua->request($req)->as_string; 
print $content;

最佳答案

添加一条指令,以便用户代理知道您的代理的位置:

$ua->proxy("http", "http://localhost:8888");

至于关于 POST 是一个有效的裸词的评论(我可能不会注意到),我的模块中有这样的内容:
use HTTP::Request::Common qw( POST GET );

关于perl - 使用代理发布参数(perl),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3233428/

相关文章:

c - tcp 服务器未从accept() 返回

linux - 在尝试使用 ssh 设置时间时寻找匹配的 `"时出现意外的 EOF

windows-phone-7 - Windows Phone 7.1.1 Ping

perl - 简单的 perl 程序无法执行

java - 具有相同端口和地址的套接字的两个实例

javascript - $.ajax post 不发布数据 (JavaScript)

c# - 在 ASP.NET 中从代码隐藏提交 POST 请求

javascript - 如何在 IE6 上监视来自 Javascript 的所有 XmlHttpRequest POST?

arrays - 如何将值推送到数组的 Perl 哈希上?

perl - 如何在 plackup 执行的 Perl Dancer 应用程序中传递命令行选项