柳暗花明笔记

    原来我不知道运行了这个file_get_contents函数后会得到一个变量的

    所属分类:[ php&web ] 猫哲学家 发表于:2015-04-09 16:20 浏览:732

    例如当你

    file_get_contents("http://www.szgjcx.com/"); //深圳公交查询 
    print_r($http_response_header);

    就相当于

    get_headers("http://www.szgjcx.com/");

    得到的结婚类似于

    Array
    (
    [0] => HTTP/1.0 200 OK
    [1] => Server: tomcat7.0.52
    [2] => Content-Type: text/html; charset=utf-8
    [3] => Content-Length: 271948
    [4] => Vary: Accept-Encoding
    [5] => Cache-Control: private
    [6] => X-AspNetMvc-Version: 4.0
    [7] => X-AspNet-Version: 4.0.30319
    [8] => X-Powered-By: ASP.NET
    [9] => Date: Thu, 09 Apr 2015 07:04:14 GMT
    [10] => Connection: close
    [11] => Set-Cookie: ASP.NET_SessionId=2iqtfj2qb2whipcwwaqwh2a4; domain=.dx.com; expires=Fri, 24-Apr-2015 07:04:14 GMT; path=/; HttpOnly
    [12] => Set-Cookie: ASP.NET_SessionId=2iqtfj2qb2whipcwwaqwh2a4; domain=.dx.com; expires=Fri, 24-Apr-2015 07:04:14 GMT; path=/; HttpOnly
    [13] => Set-Cookie: DXGlobalization=lang=en&locale=en-US&currency=USD; domain=.dx.com; expires=Fri, 24-Apr-2015 07:04:14 GMT; path=/
    [14] => Set-Cookie: DXGlobalization_lang=en; domain=.dx.com; expires=Fri, 24-Apr-2015 07:04:14 GMT; path=/
    [15] => Set-Cookie: DXGlobalization_locale=en-US; domain=.dx.com; expires=Fri, 24-Apr-2015 07:04:14 GMT; path=/
    [16] => Set-Cookie: DXGlobalization_currency=USD; domain=.dx.com; expires=Fri, 24-Apr-2015 07:04:14 GMT; path=/
    [17] => Set-Cookie: sessionCookie=4fe87be7-51cc-4839-b551-6000ecdce5d9; domain=.dx.com; path=/
    )

    标签: php 
    上一编文章 php curl 获取cookie及发送cookie so easy 下一编文章 自己写个开机日志shell
    最近文章
    发表评论