即使在Windows命令提示符下的语句中指定了-c file.txt,Curl函数也不会保存cookie和会话ID。
我通过在Mac中指定-c file.txt尝试了curl语句,它工作正常。它检索会话ID和令牌。 但是,当我在Windows命令提示符下尝试它时,它仅使用以下语句创建一个file.txt,
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
但没有令牌或会话ID
我的curl陈述如下
curl -X POST -c "cookies.txt" --url myurl -d '{"loginMode":1,"username":"admin","password":"abc"}' -c "cookies.txt"
期望是要导入会话ID和令牌(在Mac中效果很好) 示例输出:
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_abc.abc.abc.com FALSE /MicroStrategyLibrary TRUE 0 JSESSIONID 2631C25C01070F5B27A0E3C721285B78
abc.abc.abc.com FALSE /MicroStrategyLibrary FALSE 0 iSessiofqes0m6amofqcrt9htmpo0orln