加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl 使用post和get

发布时间:2020-12-15 23:43:35 所属栏目:大数据 来源:网络整理
导读:url 传参格式:perl get 方式请求:use Encode;use Encode::CN;use JSON; use URI::Escape;use LWP::Simple;#$host = "http://ip.taobao.com/service/getIpInfo.php?ip=202.101.172.35";$host = " http://211.149.197.95:8888/sms.aspx?action=senduserid=74ac
url 传参格式:

perl get 方式请求:

use Encode;
use Encode::CN;
use JSON; 
use URI::Escape;
use LWP::Simple;
#$host = "http://ip.taobao.com/service/getIpInfo.php?ip=202.101.172.35";
$host = " http://211.149.197.95:8888/sms.aspx?action=send&userid=74&account=xx&password=xx&mobile=18072xx7&content=内容&sendTime=&extno=";
$content = get($host);
print "$content is $contentn";


通过get方式请求,参数所以用“&”符号来隔开。



perl post 方式请求:

use strict;
use LWP;

my $browser = LWP::UserAgent->new();
my $response= $browser->post("http://211.149.197.95:8888/sms.aspx",[ "action" => "send","userid" => "74","account" => "xx","password" => xx,"mobile" =>180xx237,"content" =>"test0612"]); #多加了

一个被发送的数据的数组

print $response->content; # 输出获得的网页内容

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读