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\n";
print "\$document_length is $document_length\n";
print "\$modified_time is $modified_time\n";
print "\$expires is $expires\n";
print "\$server is $server\n";
[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

curl 返回响应头的更多相关文章

  1. 【转载】curl 模拟 GET\POST 请求,curl查看响应头 以及 curl post 上传文件

    补充说明:curl查看响应头 curl -I "http://www.baidu.com"HTTP/1.1 200 OK #HTTP协议 HTTP 返回码Server: Tengi ...

  2. php curl 获取请求头与DNS解析

    1 php-curl方法相关设置具体方法在最下方的示例函数有相关编著, 这里主要描述两个小众需求a 设置访问DNS解析问题点: get请求网页获取返回值速度很快, 但是使用curl请求数据时, 响应速 ...

  3. HTTP协议扫盲(二)HTTP协议的请求方法、请求头和响应头

    一.HTTP请求方法 Http协议定义了很多与服务器交互的方法,最基本的有4种,分别是GET,POST,PUT,DELETE. 一个URL地址用于描述一个网络上的资源,而HTTP中的GET, POST ...

  4. Http请求头和响应头(Get和Post)

    HTTP简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于从万维网(WWW:World Wide Web )服务器传输超文本到本地浏览器的传送 ...

  5. php CURL 请求头和响应头获取

    1.从CURL中获取响应头 $oCurl = curl_init(); // 设置请求头, 有时候需要,有时候不用,看请求网址是否有对应的要求 $header[] = "Content-ty ...

  6. AFNetworking HTTP响应头返回数据

    //发送验证码 NSLog(@"发送验证码"); AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationM ...

  7. wget/curl查看请求响应头信息

    wget / curl 是两个比较方便的测试http功能的命令行工具,大多数情况下,测试http功能主要是查看请求响应 头信息 ,而给这两个工具加上适当的命令行参数即可轻易做到,其实查man手册就能找 ...

  8. HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码

    原文地址:HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码 HttpServletRespo ...

  9. HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码

    HttpServletResponse  和 ServletResponse  都是接口 具体的类型对象是由Servlet容器传递过来   ServletResponse对象的功能分为以下四种:   ...

随机推荐

  1. List用法

    定义一个类: using System;using System.Collections.Generic;using System.Linq;using System.Web; namespace W ...

  2. spring 入门篇

    spring 入门篇         相对于Hibernate(冬眠),Spring(春天),具有更多的诗意与希望的感觉,是为了解决传统J2EE开发效率过低.开发商之间不统一.没有真正实现“写一次到处 ...

  3. 【转】jsp 表单form传值

    写的很好,看到了忍不住不转啊,希望可以分享一下~~ 转载自http://blog.csdn.net/anmei2010/article/details/4140216 页面间链接和数据传递的三种方式 ...

  4. HDU 5729 Rigid Frameworks(连通性DP)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5729 [题目大意] 给出一个n*m的方格框,可以在单位矩形中添加两种对角线的线,使得其变得稳定,问 ...

  5. linux 在终端中打开图形化文件管理器

    虽然终端十分强大,但在少数使用终端的时候,会突然需要图形化文件管理器的帮忙. 命令: xdg-open "dir" 例如 xdg-open ./ 用图形化文件管理器打开当前文件夹 ...

  6. dataguard dubugs

    alter database open read only;alter database open read only*ERROR at line 1:ORA-10456: cannot open s ...

  7. tp中phpexcel导出实例

    public function phpexcel(){ //测试$this->display("User:xx");//跨模块分配页面User模块xx.html // xx\ ...

  8. Java程序栈信息文件中的秘密(五)

    最近发现在使用jstack工具在导出Java应用的线程栈时有一个小小的窍门,比如Linux环境上有一个用户为appuser,假如以这个用户启动了一个Java进程B,如果想要导出进程B的线程栈,则必须切 ...

  9. js 定义类对象

    //定义类     //方式一     function A_class(arg1,arg2){         this.arg1=arg1;         this.arg2=arg2;     ...

  10. unity3d插件Daikon Forge GUI 中文教程-5-高级控件listbox和progress bar的使用

    (游戏蛮牛首发)大家好我是孙广东.官网提供了专业的视频教程http://www.daikonforge.com/dfgui/tutorials/,只是是在youtube上,要观看是须要FQ的. 只是教 ...