一聪蘸、curl常見用法
- url=http://www.baidu.com
- get請(qǐng)求:curl $url
- post請(qǐng)求:curl -d 'xxx' $url
- proxy使用:curl -x 'http://127.0.0.1:8080' $url (引號(hào)內(nèi)內(nèi)容表示代理地址)
二宪肖、重要參數(shù)
參數(shù) | 含義 |
-H ’Content-type:application/json' | 消息頭設(shè)置(重要) |
-u username:password | 用戶認(rèn)證,包括token認(rèn)證之類的 |
-d | 要發(fā)送的post數(shù)據(jù) @file 表示來(lái)自于文件 |
--data -urlencode ‘page_size=50’ | 對(duì)內(nèi)容進(jìn)行url編碼 |
-G | 把data數(shù)據(jù)當(dāng)成get請(qǐng)求的參數(shù)發(fā)送健爬,常與--data -urlencode結(jié)合使用(post轉(zhuǎn)為get時(shí)候使用) |
-o | 寫文件控乾,通常用于下載 |
-x | 代理http代理 socks5代理 |
-v berbose | 打印更詳細(xì)的日志 |
-s | 關(guān)閉一些提示輸出 |