<pre name="code" class="html">jrhmpt01:/root# cat login_yylc.pl
use LWP::UserAgent;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
use Net::Ping;
use Socket;
use Net::SMTP;
use LWP;
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use URI::Escape;
use URI::URL;
use Data::Dumper;
my $ua = LWP::UserAgent->new;
$ua->timeout(5);
$ua->env_proxy;
$ua->agent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0");
my $cookie_jar = HTTP::Cookies->new(
file=>'lwp_cookies.txt',
autosave=>1,
ignore_discard=>1);
$ua->cookie_jar($cookie_jar); #$var='https://licai.yingyinglicai.com/index.htm';
#<input type="hidden" id="token" name="token" value="3E79AB8CF9603A03DF74DDD6154A8BAD"/> my $var='https://licai.yingyinglicai.com/user/login.htm';
my $response = $ua->get($var);
$var= $response->decoded_content;
##<input type="hidden" id="token" name="token" value="7C84D7FD0889D23EAA8D266979552D2D"/> if ($var =~/.*token"\s+value="(.*?)"/.*/)
{print "\$1 is $1\n";
$token=$1;
}; my $login_url = 'https://licai.yingyinglicai.com/user/loginByPwd.do'; my $res = $ua->post($login_url,{
'cell'=>18072xx2237,
'password'=>80xx5,
'token'=>$token
},
'Host'=>'licai.yingyinglicai.com',
'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0' );
my $homepage;
print "header-----------------\n";
print $res->header('Location');
print "header-----------------\n"; $1 is DC341A499F42389A5EA4841042C7C04F
header-----------------
http://licai.yingyinglicai.com/index.htm
header----------------- $h->header( $field )
$h->header( $field => $value )
$h->header( $f1 => $v1, $f2 => $v2, ... ) 获取或者设置 一个或者多个header字段的值,header 字段名($field)不是大小写敏感的。 为了使perl 用户生活更简单 需要避免引号在=>操作符前,你可以使用'_' 作为一个替代'-' 在header names header()方法接收多个键值对,这意味着你可以更新多个fields在一个领域 Examples: $header->header(MIME_Version => '1.0',
User_Agent => 'My-Web-Client/0.01');
$header->header(Accept => "text/html, text/plain, image/*");
$header->header(Accept => [qw(text/html text/plain image/*)]);
@accepts = $header->header('Accept'); # get multiple values
$accepts = $header->header('Accept'); # get values as a single string 响应头:
Connection
keep-alive
Content-Language
zh-CN
Content-Length
0
Date
Wed, 03 Aug 2016 12:22:20 GMT
Location
http://licai.yingyinglicai.com/index.htm
Server
nginx
Set-Cookie
YYLCSJSESSIONID=f9d49ab5-acc4-4518-a6ab-ec73a6ae39eb; Domain=yingyinglicai.com; Expires=Wed, 03-Aug-2016
12:52:20 GMT; Path=/ print $res->header('Server'); 返回nginx
												

http 响应头之location的更多相关文章

  1. HTTP请求的基本概念 HTTP请求头和响应头的含义

    1,HTTP请求的基本概念    TCP/UPD/HTTP    *2,HTTP请求头和响应头的含义  请求头:  Accept: text/html,image/*(浏览器可以接收的类型)  Acc ...

  2. HTTP协议请求头信息和响应头信息

    阅读目录 http的请求部分 常用请头信息 常用响应头信息 http的请求部分 基本结构 请求行 GET  /test/hello.html HTTP/1.1 消息头(并不是每一次请求都一样) 空行 ...

  3. HTTP 请求头 & 响应头

    HTTP请求头概述 HTTP客户程序(例如浏览器),向服务器发送请求的时候必须指明请求类型(一般是GET或者POST).如有必要,客户程序还可以选择发送其他的请求头.大多数请求头并不是必需的, 但Co ...

  4. 响应头location 页面跳转

    登陆:http://192.168.32.161/DEVOPS/index.php/Index/do_login Cache-Control no-store, no-cache, must-reva ...

  5. 通过location响应头实现重定向

    package day08; import java.io.IOException; import javax.servlet.ServletException; import javax.servl ...

  6. PHP--获取响应头(Response Header)方法

    方法一: $baiduUrl = "http://www.baidu.com/link";   file_get_contents($baiduUrl); $responseInf ...

  7. HTTP协议---HTTP请求中的常用请求字段和HTTP的响应状态码及响应头

    http://blog.csdn.net/qxs965266509/article/details/8082810 用于HTTP请求中的常用请求头字段 Accept:用于高速服务器,客户机支持的数据类 ...

  8. 转:PHP--获取响应头(Response Header)方法

    转:http://blog.sina.com.cn/s/blog_5f54f0be0102uvxu.html PHP--获取响应头(Response Header)方法 方法一: ========== ...

  9. Android系列之网络(二)----HTTP请求头与响应头

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...

随机推荐

  1. qrcode各版本/各类型容量支持表

    1.qrcode共有40个版本,支持各种类型数据.个人一般统一转换成8位字节进行算法存储.(汉字 --uff8占用3个字节)

  2. error C4996 The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name

    error C4996: 'strupr': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ co ...

  3. iOS定位与地图

    定位: 手机上定位的实现主要有三种方式:基站(附近基站的位置),wifi(所连接路由器的位置),卫星(最准确,也最耗能). iOS的定位功能主要是由CLLocationManager类来完成的.这个类 ...

  4. java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception

    在使用ajax主题时出现上述错误的解决办法是将form表单中的action属性值改为*.action后就可以解决.至于为什么会这样不太明白.但是修改action的属性值以后就会出现另一个错误即 对应的 ...

  5. Android DatePicker和TimePicker

    监测日期改变的监听器:      OnDateChangedListener和OnTimeChangedListener()           当用户改变Datepicker里的年.月.日时,将触发 ...

  6. php curl函数实例

    <?php function login(){ $url = 'http://jspatch.qq.com/offline/check?qver=6.2.0.427&hver=0& ...

  7. charset

    <meta charset="UTF-8" /> 这是html5的写法. <meta http-equiv=“content-type” content=“tex ...

  8. const 用在函数后

    类的成员函数后面加 const,表明这个函数不会对这个类对象的数据成员(准确地说是非静态数据成员)作任何改变.C++支持常量性不同的重载,例如下面的GetData函数. #include " ...

  9. 异构数据源海量数据交换工具-Taobao DataX 下载和使用

    DataX介绍 DataX是一个在异构的数据库/文件系统之间高速交换数据的工具,实现了在任意的数据处理系统(RDBMS/Hdfs/Local filesystem)之间的数据交换. 目前成熟的数据导入 ...

  10. Android应用中使用自定义文字

    在Android系统中可以很方便的修改字体样式.系统提供了三种样式,分别是sans,serif,monospace.可以在xml布局文件中通过 android:typeface="[sans ...