9
curl检查访问网页返回的状态码
source link: https://blogread.cn/it/article/1230?f=hot1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
curl检查访问网页返回的状态码
浏览:4648次 出处信息
这里以www.google.com、www.baidu.com、www.lazysa.com为例:
#urls=('www.baidu.com' 'www.google.com' 'www.lazysa.com'); for i in ${urls[@]}; do http_code=$(curl -I -s $i -w %{http_code}); echo $i status: ${http_code:9:3}; done www.baidu.com status: 200 www.google.com status: 200 www.lazysa.com status: 200
从结果可以看出三个网站都正常返回200代码。
建议继续学习:
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
扫一扫订阅我的微信号:IT技术博客大学习
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK