Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use server curl to simulate postman login and download under linux?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

For work requirements, you need to export a report at a fixed time every day, but because you need to log in first, use the server curl to simulate the download, as shown below:

#! / bin/bashcurdate= `date +% Ymure% mmury% d` # get tokena= `curl-H "Content-Type:application/json"-d'@ 1.json' http://x.x.x.x/ua/login`token=`echo $a first | awk-F '{print $2}' | awk-F:'{print $2}'| awk-F\ "'{print $2}'`# Export region GetArea () {curl-o Area 'http://x.x.x.x/s1mca2iot-epidemicm11anage/e1pide1micsituationdailygg/exportAreaStatistic'-H' Accept-Encoding: gzip, deflate'-H 'Accept-Language: zh,en Qcoach 0.9-H 'User-Agent: Mozilla/5.0 (Macintosh) Intel Mac OS X 10: 14: 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36'-H'Accept: application/json, text/plain, * / *'- H 'Connection: keep-alive'-H "token: $token"-- compressed} exportExcelWithArea () {curl-o exportExcelWithArea "http://x.x.x.x/sss33mcccaiot-epid1emic2man1a1ge/epi2demic1situationdailygg/exportExcelWithArea?currentDay=$curdate"-H' Accept-Encoding: gzip Deflate'-H 'Accept-Language: zh,en Text/plain, * / *'- H 'Connection: keep-alive'-H "token: $token"-- compressed} GetAreasleep 3exportExcelWithAreasleep 30

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report