linux使用wget
wget is a Linux command-line utility for retrieving files
from the web, via HTTP, HTTPS and FTP protocols. When you are using wget to
download a file at a particular HTTP url, wget sends an appropriate
HTTP request to a destination web server.
To view default HTTP request header being sent by wget, you
can use "-d" option.
---request begin---
GET / HTTP/1.0
User-Agent: Wget/1.12 (linux-gnu)
Accept: */*
Host: www.google.com
Connection: Keep-Alive ---request end---
Sometimes you may want to customize the default HTTP request header used by wget.
For example, you may want to customize "User-Agent" field as some sites rely on "User-Agent" string to block robots like wget to
retrieve their content. You may want to add an additional "Accept-Encoding" field in order to test encoding schemes of your web server. In some other cases, you may need to set "Host" field properly to be able to access a web server running on name-based virtual
hosting.
wget allows you to send an HTTP request with custom HTTP headers.
To supply custom HTTP headers, use "--header" option. You can use "--header" option as many time as you want in a single run.
---request begin---
GET / HTTP/1.0
User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
Accept: */*
Host: www.google.com
Connection: Keep-Alive
Referer: http://xmodulo.com/
Accept-Encoding: compress, gzip ---request end---
If you would like to permanently set the default HTTP request header you want to use with wget,
you can use ~/.wgetrc configuration file. You can specify as many header fields as you want in ~/.wgetrc.
header = User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
header = Referer: http://xmodulo.com/
header = Accept-Encoding: compress, gzip
Once you have configured ~/.wgetrc, you no longer need to use "--header" option with wget.
curl is another command-line tool with similar functionality
as wget. The curl utility
also allows you to set a custom HTTP header. Refer to this
guideline for detail on curl.
linux使用wget的更多相关文章
- linux服务器wget无法成功解析域名及程序获取外网数据不稳定问题
1.问题描述: 1.1 最近发现通过linux服务器wget下载远程文件经常提示无法解析域名问题,要重复多次才能成功,成功率比较低. 1.2 PHP用file_get_contents()函数获取淘宝 ...
- linux使用wget纯命令下载JDK的方法(凑字数)
linux使用wget纯命令下载JDK的方法 linux使用wget纯命令下载JDK的方法 Oracle官网上下载jdk,需要点击accept licence的才能下载,所以一般的直接使用wget下载 ...
- linux 使用wget下载https连接地址cannot verify github.com's certificate
使用linux的wget下载时候会出现网站没有证书警告的问题, 例如下载git时,可以使用wget https://github.com/git/git/archive/v2.3.0.zip --no ...
- linux中wget未找到命令
(转)linux中wget未找到命令 转:https://blog.csdn.net/djj_alice/article/details/80407769 在装数据库的时候发现无法使用wget命令 ...
- Linux使用wget仿站
运行命令 $ wget -r -p -np -k www.avatrade.cn 参数说明 -r --recursive(递归) specify recursive download.(指定递归下载) ...
- [转帖]Linux的wget命令详解
Linux的wget命令详解 来源不明 找到的也是转帖的 https://www.cnblogs.com/cindy-cindy/p/6847502.html Linux wget是一个下载文件的工具 ...
- linux执行wget url时提示“无法建立 SSL 连接”
linux执行wget url时提示“无法建立 SSL 连接” 原因: wget在使用HTTPS协议时,默认会去验证网站的证书,而这个证书验证经常会失败 解决方案: 1.加上参数“--no-check ...
- linux命令 wget
Linux系统中的wget是一个下载文件的工具,它用在命令行下.对于Linux用户是必不可少的工具,我们经常要下载一些软件或从远程服务器恢复备份到本地服务器.wget支持HTTP,HTTPS和FTP协 ...
- Linux指令--wget
Linux系统中的wget是一个下载文件的工具,它用在命令行下.对于Linux用户是必不可少的工具,我们经常要下载一些软件或从远程服务器恢复备份到本地服务器.wget支持HTTP,HTTPS和FTP协 ...
- Linux的wget命令详解【转载】
Linux wget是一个下载文件的工具,它用在命令行下.对于Linux用户是必不可少的工具,尤其对于网络管理员,经常要下载一些软件或从远程服务器恢复备份到本地服务器.如果我们使用虚拟主机,处理这样的 ...
随机推荐
- bzoj1568 Blue Mary
题意:P:加入一条一次函数.Q:询问x位置的最大函数值. 标程: #include<bits/stdc++.h> using namespace std; ; int q,x,n; dou ...
- Windows 获取控制台窗口句柄
详细信息 因为多个窗口可能具有相同的标题,您应该更改当前的控制台窗口标题为唯一的标题.这将有助于防止返回不正确的窗口句柄.使用 SetConsoleTitle() 来更改当前的控制台窗口标题.下面是此 ...
- DOM——获取页面元素
获取页面元素 为什么要获取页面元素 例如:我们想要操作页面上的某部分(显示/隐藏,动画),需要先获取到该部分对应的元素,才进行后续操作 根据id获取元素 var div = document.getE ...
- Parse-轻松构建移动APP的后台服务
目前正在开发的产品告一段落,有时间总结下经验,也顺便分享一下我们主要使用的平台-Parse. 什么是Parse? Parse是一群美国人开发的专为移动APP服务的云计算平台,与现有的其他云计算平台相 ...
- 扩展gcd求逆元
当模数为素数时可以用费马小定理求逆元. 模数为合数时,费马小定理大部分情况下失效,此时,只有与模数互质的数才有逆元(满足费马小定理的合数叫伪素数,讨论这个问题就需要新开一个博客了). (对于一个数n, ...
- 372 在O(1)时间复杂度删除链表节点
原题网址:http://www.lintcode.com/zh-cn/problem/delete-node-in-the-middle-of-singly-linked-list/ 给定一个单链表中 ...
- 修改sql server表字段的字符串
网站标题被注入黑链接,使用sql脚本update修改字段内的字符串截取UPDATE [qds0460132_db].[dbo].[Blood_News] SET [Blood_Name] = SU ...
- [kuangbin带你飞]专题一 简单搜索 - B - Dungeon Master
#include<iostream> #include<cstdio> #include<string> #include<vector> #inclu ...
- [AHOI2014/JSOI2014]骑士游戏
题目 思博贪心题写了一个半小时没救了,我也没看出这是一个\(spfa\)来啊 设\(dp_i\)表示彻底干掉第\(i\)只怪物的最小花费,一个非常显然的事情,就是对于\(k_i\)值最小的怪物满足\( ...
- 制作FastDFS的RPM包
首先获取fastdfs的源码,因为fastdfs还依赖一个libfastcommon的库,所以也要准备好. fastdfs的源码目录结构: libfastcommon的源码目录结构: 接下来将以Cen ...