您好,登錄后才能下訂單哦!
工作需求,需要每日定時導出一個報表,但是由于要先登錄,所以使用服務器curl模擬下載,具體如下:
#!/bin/bash
curdate=`date +%Y-%m-%d`
#先獲取token
a=`curl -H "Content-Type:application/json" -d '@1.json' http://x.x.x.x/ua/login`
token=`echo $a|awk -F , '{print $2}' |awk -F : '{print $2}' |awk -F \" '{print $2}'`
#導出區(qū)域
GetArea() {
curl -o Area 'http://x.x.x.x/s1mca2iot-epidemicm11anage/e1pide1micsituationdailygg/exportAreaStatistic' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: zh,en;q=0.9,ja;q=0.8,zh-TW;q=0.7,fr;q=0.6,zh-CN;q=0.5' -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;q=0.9,ja;q=0.8,zh-TW;q=0.7,fr;q=0.6,zh-CN;q=0.5' -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
}
GetArea
sleep 3
exportExcelWithArea
sleep 30
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。