Reading a ServerXMLHTTP request in Classic ASP

1.4k views Asked by At

I'm using Msxml2.ServerXMLHTTP.6.0 to POST/GET data from Twitters API. Everything is working fine apart from one API function.

I need to see what I'm sending to api.twitter.com so I can fix it.

The script was written by someone else and is very long and complicated, but this is the send function which fires the request off to twitter:

Dim objXMLHTTP : Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
    objXMLHTTP.setTimeouts OAUTH_TIMEOUT_RESOLVE, OAUTH_TIMEOUT_CONNECT, OAUTH_TIMEOUT_SEND, OAUTH_TIMEOUT_RECEIVE
    objXMLHTTP.Open m_strRequestMethod, strRequestURL, False
    objXMLHTTP.SetRequestHeader "Content-Type","application/x-www-form-urlencoded"

    objXMLHTTP.SetRequestHeader "User-Agent", m_strUserAgent
    objXMLHTTP.SetRequestHeader "Host", m_strHost                           

    objXMLHTTP.Send()

    Set objXMLHTTP = Nothing

Is there anyway I can see what is being sent in its RAW format?

Thanks

1

There are 1 answers

0
Polynomial On

To my eye it looks like it's sending very little. To dissect the code:

Dim objXMLHTTP : Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")

Declare and set the object.

objXMLHTTP.setTimeouts OAUTH_TIMEOUT_RESOLVE, OAUTH_TIMEOUT_CONNECT, OAUTH_TIMEOUT_SEND, OAUTH_TIMEOUT_RECEIVE

Set the timeouts to a bunch of constants.

objXMLHTTP.Open m_strRequestMethod, strRequestURL, False

Open a URL (whatever strRequestURL equals), likely as either as a GET or POST (whatever m_strRequestMethod equals).

objXMLHTTP.SetRequestHeader "Content-Type","application/x-www-form-urlencoded"
objXMLHTTP.SetRequestHeader "User-Agent", m_strUserAgent
objXMLHTTP.SetRequestHeader "Host", m_strHost                           

Set three common request headers. The first is the normal way POST data is sent (basically, as a giant querystring), the other two specify information about the sender.

objXMLHTTP.Send()

Send the request.

Set objXMLHTTP = Nothing

Destroy the object.


Sorry I can't be more helpful, but if that is all the code (and the fact that it goes from object creation to destruction implies so) I really can't see that it is sending much data aside from what is potentially in the URL itself. strRequestURL, m_strUserAgent and m_strHost is really the only custom data being sent - looking at their values should tell you everything unique about the requests.