用curl模拟夹带cookie的http请求

时间:2021-10-15 17:02:20

1. 首先登录所要登录的网站,发起http请求,获取cookie

用curl模拟夹带cookie的http请求

2. 获取请求的真正的路径,现在的前端比如vue都是用自定义路径映射后端路径的,比如在vue中某个请求为caojiangjiang/test,那么它实际映射的路径可能为cjj/cjj/test,所以要获取真实的url,这一点可以问公司的op(运维),也可以通过手机访问网站,然后自己抓包获取真正的请求路径

curl -b "bi_device_id=8d7e6a00-299d-417e-8dc6-96b777427c1f; acw_tc=76b20fe615452129218561722e7743ff9e08bc666f839d50de436ff69ba9ab; QXUEXI-AUTH-TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwIjoicGMiLCJrIjoic2lnbmluVDE4MzU5MjY1MTkwcGFzc3BjNWMyZDlhNmI2ZDFlZiIsImMiOiJUIiwidWlkIjoiNjY0NzAifQ.MAxWRv1os9_wY1_CgeknBFB31XTplFlNVFF36V7RUFU; QXUEXI_SIGNER_ID=66470; QXUEXI-AUTH-TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwIjoicGMiLCJrIjoic2lnbmluVDE4MzU5MjY1MTkwcGFzc3BjNWMyZDlhNmI2ZDFlZiIsImMiOiJUIiwidWlkIjoiNjY0NzAifQ.MAxWRv1os9_wY1_CgeknBFB31XTplFlNVFF36V7RUFU; QXUEXI_SIGNER_ID=66470; Hm_lvt_599aca18636a86abbf2f0e8706849e27=1546841299; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2216827999945297-09986a22cdda47-35607400-1024000-168279999467ad%22%7D; Hm_lpvt_599aca18636a86abbf2f0e8706849e27=1546852604"  -A "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.0)"  xxxxxxxxxx/merchant/classroom/into -X POST -d "usertype=1&roomid=12&jumpurl=xxxxxx&extraData=dfdfdd" 

-b "" 添加cookie

-X POST

-d "a=xx&b=xx"

-A "" 模拟浏览器请求

url 直接写,不加引号或者双引号