Hello, I have been trying to get wget to login automatically to a site and it keeps redirecting me to a login page saying that my session has expired. One thing about the login page is that it sets a cookie using javascript right before the login form is submitted. I have tried many tricks to fix this but nothing seems to work. I can login through my browser and copy the cookie values. This seems to work but I would like my script to be self sufficient.
Here is the form tag: <form name="form" method="post" action=" https://www.yourfavouritesite.com/login.asp" onsubmit="return SetCookie()"> Here is the javascript function: function SetCookie() { var idField = document.getElementById("idField"); var cookieName = "ID"; var cookieValue = idField.value; var nDays = 30; var today = new Date(); var expire = new Date(); if (nDays==null || nDays==0) nDays=1; expire.setTime(today.getTime() + 3600000*24*nDays); document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString(); return true; } Here is my current approach: wget -O /dev/null/ --keep-session-cookies --save-cookies=cookies.txt --header "Cookie: ID=myID;expires=Sun, 6 Jun 2010 09:09:07 UTC" --post-data "ID=myID&password=mypassword" https://www.example.com/login.asp Any help would be greatly appreciated. Eric Coulthard ================== Programmer Analyst
