wget使用方法(some)

wget使用方法(some)

前提說明:

Web服務器http://127.0.0.1:8333/test.php 是我自己搭建的一臺nginx+phpweb服務器

1 post請求

Wget默認發送Get請求,通過指定參數--post-dataor --post-file 這兩個選項

e.g wget--post-data "aaaa" http://127.0.0.1:8333/test.php

         wget--post-data "user=foo" http://127.0.0.1:8333/test.php

         wget–post-file post_file http://127.0.0.1:8333/test.php

2 head請求

wget --debug--spider http://127.0.0.1:8333/test.php

         --spider並不下載文件,通過head請求服務器,獲取web服務器響應

3 –no-cache禁用緩存

e.g   wget–no-cache http://127.0.0.1:8333/test.php

         請求數據包頭部Pragma:no-cache,不使用緩存,http1.1加上Cache-Control: no-cache, must-revalidate

4 –referer使用referer

Referrer主要用戶點擊的上一個頁面,一般可以用做防盜鏈技術,防盜鏈可以在url後面加一個key=value加密字段,或者使用特定referer字段。

e.g   wget–debug –referer www.baidu.com http://127.0.0.1:8333/test.php

5 顯示wget幫助和版本信息

Wget –v or wget –h

6 –e 就是執行命令

e.g wget-e "postdata=111111111" http://localhost:8333/test.php

這種形式和wget –post-data=”11111111” http://localhost:8333/test.php是相同的。

 

7 logfile (-o)把debug信息輸出到文件

e.g wget http://localhost:8333/test.php -ologfile

8 referer設置

e.g wget --debug  --referer "www.baidu.com/dsadsa" www.baidu.com/index.html

發佈了83 篇原創文章 · 獲贊 8 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章