zoukankan      html  css  js  c++  java
  • curl 返回响应头

    demo:/root# curl -i baidu.com
    HTTP/1.1 200 OK
    Date: Wed, 27 Jul 2016 08:50:03 GMT
    Content-Type: text/html; charset=utf-8
    Transfer-Encoding: chunked
    Connection: Keep-Alive
    Vary: Accept-Encoding
    Set-Cookie: BAIDUID=0012CCC7FDB7C71CCFD7564DF73CCCAA:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
    Set-Cookie: BIDUPSID=0012CCC7FDB7C71CCFD7564DF73CCCAA; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
    Set-Cookie: PSTM=1469609403; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
    Set-Cookie: BDSVRTM=0; path=/
    Set-Cookie: BD_HOME=0; path=/
    Set-Cookie: H_PS_PSSID=1446_18240_20416_19861_15954_11956_20705_20696; path=/; domain=.baidu.com
    P3P: CP=" OTI DSP COR IVA OUR IND COM "
    Cache-Control: private
    Cxy_all: baidu+938d6eaf9bc28d04fd2b7d2ebd708c74
    Expires: Wed, 27 Jul 2016 08:49:57 GMT
    X-Powered-By: HPHP
    Server: BWS/1.1
    X-UA-Compatible: IE=Edge,chrome=1
    BDPAGETYPE: 1
    
    
    head($url)
    Get document headers. Returns the following 5 values if successful: ($content_type, $document_length, $modified_time, $expires, $server)
    
    Returns an empty list if it fails. In scalar context returns TRUE if successful.
    
    
    得到document headers. 返回下面5个值如果成功的话 
    
    ($content_type, $document_length, $modified_time, $expires, $server)
    
    
    [root@dr-mysql01 0727]# cat a1.pl 
    use LWP::Simple; 
    my $host='http://www.baidu.com';
    ($content_type, $document_length, $modified_time, $expires, $server)= head($host);
      print "$content_type is $content_type
    ";
      print "$document_length is $document_length
    ";
      print "$modified_time is $modified_time
    ";
      print "$expires is $expires
    ";
      print "$server is $server
    ";
    [root@dr-mysql01 0727]# perl a1.pl 
    $content_type is text/html
    $document_length is 277
    $modified_time is 1465786250
    $expires is 
    $server is bfe/1.0.8.14

  • 相关阅读:
    Android的webview的设置参数
    禁止RecycleView滑动
    Volley加载不出图片的问题
    LIstview滑动时不加载图片,停止时加载!
    【原创】设计模式开篇—面向对象的软件设计
    [原创]写给自己的总结—2014到2015
    【原创】开车分四个阶段的话,你属于哪个
    【原创】亲身经历的几次合同陷阱
    【转】程序员需谨记的8条团队开发原则
    【转】绩效考核的10大误区
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350469.html
Copyright © 2011-2022 走看看