我正在开发一个需要通过会话进行身份验证的脚本,我正在尝试使用curl来存储和检索cookie数据。我可以将数据存储到cookies.txt文件中,但是当我尝试检索cookie数据时,它没有被发送
curl -c cookies.txt %AUTHURL%
curl -c cookies.txt -b cookies.txt -d "webUsername=admin&webPassword=1111" %AUTHURL2% >> %logfile%
curl -c cookies.txt -b cookies.txt -d "HTTP_Set_Config_Attrib=FALSE" %POSTURL% >> %logfile%
在此
之后创建cookies.txt文件# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
192.168.0.12 FALSE / TRUE 0 PHPSESSID 4b292d94766690a9fc2539f29109406f
然而,当我第二行连线时
POST /userpost/x.set HTTP/1.1
User -Agent: curl/7.15.1 (i386-pc-win32) libcurl/7.15.1 OpenSSL/0.9.8a zlib/1.2.3
Host: 192.168.0.12
Accept: */*
Content-Length: 90
Content-Type: application/x-www-form-urlencoded
HTTP_Authenticate_fn&webUsername=admin&webPassword=1111
我没有看到cookie值,如果我在网络浏览器中执行此操作,则wireshark会显示
Cookie: PHPSESSID=b7419746c6e18ffd357a408c95e1ad3a
我已经尝试了几乎所有我能想到的组合,包括cookies.txt文件的显式路径。