zoukankan      html  css  js  c++  java
  • perl lwp 获取请求头

    <pre name="code" class="html">[root@dr-mysql01 ~]# cat getx.pl 
    use LWP::UserAgent;
     $ua = LWP::UserAgent->new;
     @header = (
        'accept'=> "application/json",
        'content-type'=> "application/json",
        'apix-key'=> "e7b00871640c49567a37566ccd5c27e9",
        'User-Agent' => "Mozilla/8.0"
        );
    
    $host="http://zjcap.cn";
    $request = HTTP::Request->new(GET=>"$host");
    $request->header(@header);
    use Data::Dumper;
    print Dumper($request);
     my $hdrs = $request->headers;
    print "111111111111111111111
    ";
    print Dumper($hdrs);
    [root@dr-mysql01 ~]# perl getx.pl 
    $VAR1 = bless( {
                     '_uri' => bless( do{(my $o = 'http://zjcap.cn')}, 'URI::http' ),
                     '_method' => 'GET',
                     '_content' => '',
                     '_headers' => bless( {
                                            'content-type' => 'application/json',
                                            'user-agent' => 'Mozilla/8.0',
                                            'apix-key' => 'e7b00871640c49567a37566ccd5c27e9',
                                            'accept' => 'application/json',
                                            '::std_case' => {
                                                              'apix-key' => 'Apix-Key'
                                                            }
                                          }, 'HTTP::Headers' )
                   }, 'HTTP::Request' );
    111111111111111111111
    $VAR1 = bless( {
                     'content-type' => 'application/json',
                     'user-agent' => 'Mozilla/8.0',
                     'apix-key' => 'e7b00871640c49567a37566ccd5c27e9',
                     'accept' => 'application/json',
                     '::std_case' => {
                                       'apix-key' => 'Apix-Key'
                                     }
                   }, 'HTTP::Headers' );


    
       
    
    
  • 相关阅读:
    redis之Scan
    redis之GeoHash
    redis之漏斗限流
    redis之布隆过滤器
    redis之HyperLogLog
    redis位图
    redis延迟队列
    redis分布式锁
    如何安装redis
    社区首款 OAM 可视化平台发布!关注点分离、用户友好、上手难度低
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199760.html
Copyright © 2011-2022 走看看