欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux curl命令 博客分类: Linux CentOSlinux 

程序员文章站 2024-03-18 15:25:04
...
参考:http://www.linuxdiyf.com/linux/2800.html
http://dbajun.iteye.com/blog/1813801
测试访问网页:
[zabbix@zabbix server]$ curl www.baidu.com
<!DOCTYPE html><!--STATUS OK--><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta content="always" name="referrer">
...
...
'result_form':"#form",'result_kw':"#kw"});</script><script>if(navigator.cookieEnabled){document.cookie="NOJS=;expires=Sat, 01 Jan 2000 00:00:00 GMT";}</script></body></html>
[zabbix@zabbix server]$
路径访问:
[zabbix@zabbix server]$ curl http://donald-draper.iteye.com/admin/blogs/2316699
<html><body>You are being <a href="http://www.iteye.com/login">redirected</a>.</body></html>[zabbix@zabbix server]$

带参数:
[zabbix@zabbix server]$ curl http://192.168.126.128/zabbix/dashboard.php?sid=9422e571896006a3
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<title>zabbixServer: Dashboard</title>
<meta name="Author" content="Zabbix SIA" />
<meta charset="utf-8" />
<meta name="msapplication-config" content="none"/>
<link rel="shortcut icon" href="images/general/zabbix.ico" />
....
.....
hat_lastiss":{"frequency":60,"url":'?output=html',"counter":0,"darken":0,"params":{"favobj":'hat',"favref":'hat_lastiss',"favaction":'refresh'}},"hat_webovr":{"frequency":60,"url":'?output=html',"counter":0,"darken":0,"params":{"favobj":'hat',"favref":'hat_webovr',"favaction":'refresh'}},"hat_hoststat":{"frequency":60,"url":'?output=html',"counter":0,"darken":0,"params":{"favobj":'hat',"favref":'hat_hoststat',"favaction":'refresh'}}});
jqBlink.blink();
cookie.init();
chkbxRange.init();
});

// ]]></script></body>
</html>
[zabbix@zabbix server]$

测试保存网页命令
[zabbix@zabbix server]$ curl -o baidu.html www.baidu.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 99583    0 99583    0     0  31378      0 --:--:--  0:00:03 --:--:-- 31374
[zabbix@zabbix server]$ ls -al
total 2092
-rw-rw-r--  1 zabbix zabbix   99583 Aug 10 17:33 baidu.html
相关标签: CentOS linux