perl发送post数据
2024-10-19 01:19:06
把post数据写进一个匿名数组里就行
#!/usr/bin/env perl -w
use strict;
use LWP::UserAgent; my $ua = LWP::UserAgent->new();
my $rp = $ua->post('http://www.baidu.com', ['username' => 'admin','passwd' => 'password'])
print $rp->content();
或
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(); my $rep = $ua->post('http://localhost/1.php', {cmd => 'whoami'});
#my $rep = $ua->post('http://localhost/1.php', ['cmd' => 'whoami']);
print $rep->content;
或
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new(POST => 'http://localhost/1.php');
$req->content('cmd=whoami');
$req->content_type('application/x-www-form-urlencoded');
my $rp = $ua->request($req);
print $rp->content;
如果用最后一个方法, 记得要带有content_type头才行
最新文章
- yii create url (二)
- centos7编译安装nginx1.8
- hdu 4939 Stupid Tower Defense ( dp )
- OCI的结果输出
- [置顶] android之存储篇_SQLite数据库_让你彻底学会SQLite的使用
- PDF解决方案(1)--文件上传
- MBR . Have it removed!
- python+selenium自动化测试环境安装
- 芝麻HTTP:Python爬虫实战之抓取爱问知识人问题并保存至数据库
- jQuery 嵌套 event 会触发多次的原因
- AX_SysTableBrowser
- 一把梭系列 之 颜值不够VsCode来凑
- CORS jsonp
- 服务器被ddos攻击?分析如何防止DDOS攻击?
- locals()
- Qt绘图
- 【洛谷 P1502】 窗口的星星(扫描线)
- HTML5+ MUI实现ajax的一个demo
- TP5.1:实现分页
- SHA256兼容性
热门文章
- [转]Windows 7 蓝屏后获取 MEMORY.DMP 文件及注意事项
- GetTickCount 和getTickCount
- Dom-直接 /间接选择器
- 【刷题】BZOJ 2882 工艺
- BZOJ2693:JZPTAP——题解
- 洛谷4578 &; LOJ2520:[FJOI2018]所罗门王的宝藏——题解
- The driver has not received any packets from the server
- ContestHunter暑假欢乐赛 SRM 05
- 【树形DP】【UVA10859】 Placing Lampposts
- Sql Server 2008 R2 数据库脚本导出方法