perl 使用post和get

来源:互联网 发布:什么是fft算法 编辑:程序博客网 时间:2024/05/21 11:20
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 $content\n";通过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; # 输出获得的网页内容

0 0
原创粉丝点击