curl --user name:password http://www.example.com
或者
curl -u name:password http://www.example.com
例:
curl --user admin:111111 “http://192.168.1.254/cgi-bin/index.cgi?mod=sys_shutdown&act=reboot”
抓包,wireshark显示如下:
参考文章:
- http://curl.haxx.se/docs/httpscripting.html
- http://stackoverflow.com/questions/3044315/how-to-set-the-authorization-header-using-curl