curl 命令使用cookie
curl -c cookie.txt www.baidu.com
cat cookie.txt
# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
.baidu.com TRUE / FALSE 4294967295 BAIDUID F12E0E84A1A44C56325C9FB70263B8B7:FG=1
[root@bsso software-rpm]# curl -b cookie.txt baidu.com -v
* About to connect() to baidu.com port 80
* Trying 220.181.6.182... * connected
* Connected to baidu.com (220.181.6.182) port 80
> GET / HTTP/1.1
User-Agent: curl/7.12.1 (i686-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
Host: baidu.com
Pragma: no-cache
Accept: */*
Cookie: BAIDUID=F12E0E84A1A44C56325C9FB70263B8B7:FG=1
...
这里旨在提醒一下cookie文件的格式,以前一直以为是name=value形式的;今天使用时,才发现:
以下是引用片段: Curl has the ability to read and write cookie files that use the same file format that Netscape and Mozilla do |
建议继续学习:
- cookie窃取和session劫持 (阅读:12697)
- Rolling cURL: PHP并发最佳实践 (阅读:10107)
- curl检查访问网页返回的状态码 (阅读:6512)
- 前端开发中Cookie那些事儿 (阅读:6026)
- 如何设置一个永远无法删除的Cookie (阅读:5047)
- 在浏览器中加密Cookie (阅读:4350)
- PHP用CURL伪造IP和来源 (阅读:4197)
- curl测试下载速度 (阅读:4139)
- 网站统计:第一方Cookie和第三方Cookie (阅读:4048)
- cURL基础教程 (阅读:3852)
扫一扫订阅我的微信号:IT技术博客大学习
- 作者:phpor 来源: PHPor 的Blog
- 标签: cookie curl
- 发布时间:2009-11-09 13:28:06
- [198] WEB系统需要关注的一些点
- [13] InnoDB insert性能拐点测试
- [12] 我的git笔记
- [12] Spark性能优化——和shuffle搏斗
- [12] 一次神奇的MySQL优化
- [11] 深入剖析 redis replication
- [11] Python 代码规范小结
- [10] Android设计中的.9.png
- [10] 浏览器的工作原理:新式网络浏览器幕后揭秘
- [9] Python程序的执行原理