zoukankan      html  css  js  c++  java
  • file_get_contents获取状态码

    <?php

    //加上@ 是为了防止file_get_contents获取失败返回至命错误,影响后面的程序运行

    @file_get_contents("http://tqybw.net");
    var_dump($http_response_header);
    //$http_response_header 数组与 get_headers() 函数类似。当使用HTTP 包装器时,$http_response_header 将会被 HTTP 响应头信息填充。
    //$http_response_header 将被创建于局部作用域中。

    ?>

    //输出结果

    array(16) {
      [0]=>
      string(15) "HTTP/1.0 200 OK"
      [1]=>
      string(20) "Accept-Ranges: bytes"
      [2]=>
      string(23) "Cache-Control: no-cache"
      [3]=>
      string(21) "Content-Length: 14722"
      [4]=>
      string(23) "Content-Type: text/html"
      [5]=>
      string(35) "Date: Wed, 28 Nov 2018 06:11:27 GMT"
      [6]=>
      string(21) "Etag: "5bf3770c-3982""
      [7]=>
      string(44) "Last-Modified: Tue, 20 Nov 2018 02:53:00 GMT"
      [8]=>
      string(39) "P3p: CP=" OTI DSP COR IVA OUR IND COM ""
      [9]=>
      string(16) "Pragma: no-cache"
      [10]=>
      string(15) "Server: BWS/1.1"
      [11]=>
      string(141) "Set-Cookie: BAIDUID=9F2F8D69F1017368E0269BCAE89CF63A:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com"
      [12]=>
      string(137) "Set-Cookie: BIDUPSID=9F2F8D69F1017368E0269BCAE89CF63A; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com"
      [13]=>
      string(111) "Set-Cookie: PSTM=1543385487; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com"
      [14]=>
      string(21) "Vary: Accept-Encoding"
      [15]=>
      string(33) "X-Ua-Compatible: IE=Edge,chrome=1"
    }


  • 相关阅读:
    Ext架构分析(6)最简单的layout:AnchorLayout
    Ext架构分析(4)Container之旅
    ext学习资源汇总
    DomQuery v1.1 高级
    Ext 2.0 教程 目录
    HDOJ2006 ( 求奇数的乘积 ) 【水题】
    HDOJ2017 ( 字符串统计 ) 【水题】
    状态模式(State)
    HDOJ2002 ( 计算球体积 ) 【水题】
    HDOJ2007 ( 平方和与立方和 ) 【水题】
  • 原文地址:https://www.cnblogs.com/yaradish/p/10031838.html
Copyright © 2011-2022 走看看