1. 程式人生 > >curl常用命令備忘

curl常用命令備忘

use div mod mon xxxx proxy http .html html

#####(輸出請求頭信息) curl -I 
xxx-Pro:test xxx$ curl -I https://www.baidu.com/   
HTTP/1.1 200 OK    
Accept-Ranges: bytes     
Cache-Control: private, no-cache, no-store, proxy-    revalidate, no-transform    
Connection: Keep-Alive    
Content-Length: 277    
Content-Type: text/html    
Date: Wed, 24 Apr 2019 09:37:25 GMT    
Etag: "575e1f6d-115"    
Last-Modified: Mon, 13 Jun 2016 02:50:21 GMT    
Pragma: no-cache    
Server: bfe/1.0.8.18     

#####(需要post的data數據) curl -d     
curl -d ‘name=xxx&passwd=yyy‘ www.baidu.com     

#####(要輸出的文件地址 輸出cookie信息) curl -c      
curl -c cookie -d ‘email=xxx&password=yyy‘ http://api.xxx.cn:8115/api/user/login              
{"errcode":0,"errmsg":"logout success...","data":    {"username":"xxx","role":"member","uid":    1100,"email":"xxx","add_time":1542010178      

#####(攜帶cookie進行請求)  curl -b cookie www.baidu.com               

#####(自定義header ) curl -H ‘User-Agent: Custom-User-Agent‘     

#####(把輸出寫到該文件)  curl -o    

curl -o ./baidu.html  http://www.baidu.com     
ls
baidu.html

    
#####(把輸出寫到該文件中,保留遠程文件的文件名) curl -O https://www.baidu.com/img/[email protected]      

 
#####(上傳文件)  curl -T xxx.txt -u 用戶名:密碼 ftp://www.xxxx.com/txt/  

  

curl常用命令備忘