坚持以客户需求至上原则
中国老牌优质服务商

Shell 利用 curl 模拟登陆

-b 参数 指定使用cookie文件

-c是往cookie文件中写cookie

-d 是指定此次登录所需的参数,通过httpfox查看

-L 指定页面自动跳转

#curl -c ck.txt --user-agent Mozilla/4.0 -d "username=****&password=*****&server_id=1&submit=true" 登陆的url 
#curl -c ck.txt -b ck.txt --user-agent Mozilla/4.0 请求的url
#! /bin/Bash
###############################
#          2013-10-23         #
#        author jackluo       #
#      net.webjoy@gmail.com   #
###############################
server_url=url
login_url=${server_url}account/login #登陆地址
for server_id in 1 2;do
        login_server_info="username=****&password=******&server_id=${server_id}&submit=true" #登陆 服务器帐号信息
        curl -c server_cookie_${server_id}.txt --user-agent Mozilla/4.0 -d ${login_server_info} ${login_url}
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}import/export_logLogin >> log.log #导入数据
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/user_keep_rate >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/device >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/recharge >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/allpropslist >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/allacslist >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/online >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/ltv >> log.log
done;
赞(69)

更专业 更快速 更方便

华夏名网VIP服务