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' );


    
       
    
    
  • 相关阅读:
    Quartz.net 定时任务在IIS中未按时执行
    扩展方法
    mysql 实用语句
    jquery each map
    js匿名函数多时注意
    ASP.NET MVC3调用分部视图
    eclipse快捷键
    regular 点滴
    适配器模式
    php代码实现简单图片下载
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199759.html
Copyright © 2011-2022 走看看