troubleshooting Question

msxML2.ServerXMLHTTP form post problem

Avatar of nem2k4
nem2k4 asked on
10 Comments1 Solution6263 ViewsLast Modified:

I am trying to write a vbscript to login to my ISP's usage meter for my broadband traffic usage. I fired up firefox with the http headers plugin and watched how the login worked. Here is the result (password/servername changed for safety!)


POST /login.fcc?TYPE=33554433&REALMOID=06-00012000-ebfa-1386-a4fc-80edbce40000&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=$SM$bPLaid7UiFr%2fcTQchTKdU5ckPa0CnhjCk2Zds2Wopak%3d&TARGET=$SM$https%3a%2f%2fwww%2eserver%2ecom%2fZZZum%2fxtraSum HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060111 Firefox/
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 139


HTTP/1.x 302 Moved Temporarily
Server: Netscape-Enterprise/6.0
Date: Fri, 17 Feb 2006 13:47:24 GMT
Set-Cookie: vgnvisitor=AGIiYw00f8M0001Kg~njXna7zf; path= /; expires=Saturday, 06-Sep-2014 23:50:08 GMT
Set-Cookie: SMTRYNO=1; path=/;
Set-Cookie: FORMCRED=QyvcAA5UVU7eexPrMzZdSBqfjvvnBEQRWvC9g/GaXX1uGh0cGF7exk7KG1/Ne0AACe0nodm8cbqYjkR6aMtxv2kkKxPyhtpX45NEC4+ArPOA1tyc35PT5sS3a8cW7iA+;path=/;
Content-Type: magnus-internal/fcc
Cache-Control: no-cache
Connection: close

So I have written this vbscript code to try and emulate this login:

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.3.0")
url = "$SM$bPLaid7UiFr%2fcTQchTKdU5ckPa0CnhjCk2Zds2Wopak%3d&TARGET=$SM$https%3a%2f%2fwww%2eserver%2ecom%2fZZZum%2fxtraSum"
xmlhttp.Open "POST",url,false
xmlhttp.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060111 Firefox/"
xmlhttp.setRequestHeader "Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
xmlhttp.setRequestHeader "Accept-Language", "en-us,en;q=0.5"
xmlhttp.setRequestHeader "Accept-Encoding", "gzip,deflate"
xmlhttp.setRequestHeader "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
xmlhttp.setRequestHeader "Keep-Alive", "300"
xmlhttp.setRequestHeader "Connection", "keep-alive"
xmlhttp.setRequestHeader "Referrer", "$SM$bPLaid7UiFr%2fcTQchTKdU5ckPa0CnhjCk2Zds2Wopak%3d&TARGET=$SM$https%3a%2f%2fwww%2eserver%2ecom%2fZZZum%2fxtraSum"

' script hangs at following step, gives timeout error

When I run this code, the final line of code hangs for 30secs and gives a timeout error. If I deliberately put the incorrect login details into the request, I get a different error to what is shown when I put in login info in my browser.

Any idea where I could be going wrong here? Is it something to do with the server's response (302 moved)? I tried the same code to simulate a login to Paypal and it worked fine...

BTW I tried setting the content-length, it didn't help. I also tried changing the timeouts - didn't help either
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros