curl指定代理_如何使用cURL指定用户代理

curl指定代理

Over the years I've shared how to perform a number of actions with cURL: how to send POST data, how to retrieve headers, follow redirects, check GZIP encoding, and more. Another useful cURL directive is sending the user agent, as some servers respond with different content or headers depending on the user agent. Let's have a look at how easy it is to send the user agent with cURL!

多年来,我分享了如何使用cURL执行许多操作: 如何发送POST数据如何检索标头遵循重定向 ,检查GZIP编码等等。 另一个有用的cURL指令是发送用户代理,因为某些服务器根据用户代理使用不同的内容或标头进行响应。 让我们看一下使用cURL发送用户代理有多么容易!

The user agent may be sent with the -A or --user-agent directives:

可以使用-A--user-agent指令发送用户代理:

curl -A "MY-USER-AGENT" https://www.whatismybrowser.com/detect/what-is-my-user-agent

# .... Your user agent is: `MY-USER-AGENT` ...

Luckily we don't rely on user agent strings as much as we did in the early days of the web, but we'd be naive to assume that they no longer modify the output of all websites!

幸运的是,我们不像早期的网络那样依赖用户代理字符串,但是我们天真地假设它们不再修改所有网站的输出!

翻译自: https://davidwalsh.name/how-to-specify-user-agent-with-curl

curl指定代理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值