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\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 返回响应头的更多相关文章
- 【转载】curl 模拟 GET\POST 请求,curl查看响应头 以及 curl post 上传文件
补充说明:curl查看响应头 curl -I "http://www.baidu.com"HTTP/1.1 200 OK #HTTP协议 HTTP 返回码Server: Tengi ...
- php curl 获取请求头与DNS解析
1 php-curl方法相关设置具体方法在最下方的示例函数有相关编著, 这里主要描述两个小众需求a 设置访问DNS解析问题点: get请求网页获取返回值速度很快, 但是使用curl请求数据时, 响应速 ...
- HTTP协议扫盲(二)HTTP协议的请求方法、请求头和响应头
一.HTTP请求方法 Http协议定义了很多与服务器交互的方法,最基本的有4种,分别是GET,POST,PUT,DELETE. 一个URL地址用于描述一个网络上的资源,而HTTP中的GET, POST ...
- Http请求头和响应头(Get和Post)
HTTP简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于从万维网(WWW:World Wide Web )服务器传输超文本到本地浏览器的传送 ...
- php CURL 请求头和响应头获取
1.从CURL中获取响应头 $oCurl = curl_init(); // 设置请求头, 有时候需要,有时候不用,看请求网址是否有对应的要求 $header[] = "Content-ty ...
- AFNetworking HTTP响应头返回数据
//发送验证码 NSLog(@"发送验证码"); AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationM ...
- wget/curl查看请求响应头信息
wget / curl 是两个比较方便的测试http功能的命令行工具,大多数情况下,测试http功能主要是查看请求响应 头信息 ,而给这两个工具加上适当的命令行参数即可轻易做到,其实查man手册就能找 ...
- HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码
原文地址:HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码 HttpServletRespo ...
- HttpServletResponse ServletResponse 返回响应 设置响应头设置响应正文体 重定向 常用方法 如何重定向 响应编码 响应乱码
HttpServletResponse 和 ServletResponse 都是接口 具体的类型对象是由Servlet容器传递过来 ServletResponse对象的功能分为以下四种: ...
随机推荐
- 转载:JS触发服务器控件的单击事件
原文地址:http://blog.csdn.net/joyhen/article/details/8485321 <script src="../Js/jquery-1.4.2.min ...
- tomcat中开启的对SSL(https)的支持
打开conf/server.xml会发现有下面一段配置被注释着: <!-- <Connector port="8443" protocol="HTTP/1.1 ...
- 获取extjs text列修改过 数据
ExtJS中表格的特性简介 表格由类Ext.grid.GridPanel定义,继承自Ext.Panel,xtype为grid 表格的列信息由Ext.grid.ColumnModel定义 表格的数据存储 ...
- mysql 存储过程 游标的使用 与定义
1.游标的作用及属性 游标的作用就是用于对查询数据库所返回的记录进行遍历,以便进行相应的操作:游标有下面这些属性: a.游标是只读的,也就是不能更新它: b.游标是不能滚动的,也就是只能在一个方向上进 ...
- Spring Jdbc使用like模糊查询
public List<WfConfigMVO> queryList(WfConfigMVO wfConfig) throws SysException { StringBuffer sq ...
- 生成输出url时,使用CSS来控制超链接的格式
在前文<生成输出url>中的第5点,介绍了使用ActionLink生成输出url中指定html标签属性. 例如, 假设Global.asax中的路由定义为: public static v ...
- jquery.validate 一些技巧
1.Validator.element() Validates a single element, returns true if it is valid, false otherwise. http ...
- DrawerLayout、CoordinatorLayout、CollapsingToolbarLayout的使用--AndroidSupportDesign练手
先po一张效果图 PS:原谅题主的懒惰吧.. 看着是不是很酷炫,那是因为5.0的动画做得好,代码其实没有多少,搞清楚这个布局的层次关系很重要. 废话不多说了,先来看布局文件 最外层是一个DrawerL ...
- andrewchilds/jQuery.DomOutline
andrewchilds/jQuery.DomOutline DOM - 使用Javascript:让用户选择一个类似Firebug的HTML元素? -
- iOS 首次启动画面,新装或更新用户可以通过它查看简介。
// // GuideViewController.h // Guide // // Created by twb on 13-9-17. // Copyright (c) 2013年 twb. Al ...