perl 模拟curl get请求

来源:互联网 发布:优酷不能登录淘宝账号 编辑:程序博客网 时间:2024/05/24 05:55
pingcurl https://cloud.seafile.com/api2/ping/"pong"use  LWP::UserAgent; my $ua = LWP::UserAgent->new;$ua->timeout(10);$ua->env_proxy;$ua->agent("Mozilla/8.0");my $host = "http://10.24.217.138:8000/api2/ping/";my $response = $ua->get($host);   $ua->default_headers;  if ($response->is_success) {      print $response->decoded_content;  # or whatever   }    else {    die $response->status_line;}


                                             
0 0
原创粉丝点击