Matthew has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
VBA
I am trying to write a web query for a site that gives a unique SESSION ID every time it is accessed. This means the code is useless after the first session times out.
Is there any way to resolve this please?
RE: VBA
Hi Matthew.
I notice this post has been unanswered for quite a while, probably because we need a bit more detail.
What language is the web site using to produce its pages? (eg. php, asp etc.)
What are you getting returned, and why is the code useless? Do you mean because the URL you give the web query needs to change each time? Have you tried just leaving out the SESSION ID from the URL?
Also, if the URL normally requires a log-in (to get the web information) then this will also be a problem. You may need to speak to the web administrator who may be able to set up a unique page based on the time and date and password. You could use an MD5 string to achieve this.
eg. public page is accessible at all times, but requires the correct md5 string. MD5 string is made up of date+time (to a 10 minute window?) + password.
PHP code on web site: md5(date("Y-m-d H:i:s", strtotime("now()"))."agreedPassword";
VBA function: see http://di-mgt.com.au/src/basMD5.bas.html or http://excelsig.org/VBA/wwHash.htm for examples. Or see Dr Soong's post at http://www.tutorials.de/forum/visual-basic/275442-md5-per-vba.html (provides a text file of the function you can copy/paste).
Then use the md5 string in your URL of the web query.
eg. http://www.thedomain.com/dir/web-query-file.php?key=hrjwky67542uierh
Hope this helps.
Regards, Rich