Question about IE vs. Firefox API support using Excel VBA

200 views
Skip to first unread message

dhfan2

unread,
Jan 16, 2009, 3:05:08 PM1/16/09
to Hiveminder API Hackers
I'm trying to use the winhttp COM component from Excel to login into
hiveminder.com, but haven't succeeded yet.

Before trying to debug why I can't login, I've noticed a discrepancy.
Firefox returns a simpler HTML page and IE seems to redirect when I
just manually enter "http://hiveminder.com/=/action/BTDT.Action.Login"
into each browser. I'm using the latest browsers on MS Vista Business
32.

I'm trying to automate the retrieval and posting of tasks using the HM
API. So far, this is what I have in my VBA module:

Option Explicit
Private Enum WinHttpRequestOption
WinHttpRequestOption_UserAgentString
WinHttpRequestOption_URL
WinHttpRequestOption_URLCodePage
WinHttpRequestOption_EscapePercentInURL
WinHttpRequestOption_SslErrorIgnoreFlags
WinHttpRequestOption_SelectCertificate
WinHttpRequestOption_EnableRedirects
WinHttpRequestOption_UrlEscapeDisable
WinHttpRequestOption_UrlEscapeDisableQuery
WinHttpRequestOption_SecureProtocols
WinHttpRequestOption_EnableTracing
WinHttpRequestOption_RevertImpersonationOverSsl
WinHttpRequestOption_EnableHttpsToHttpRedirects
WinHttpRequestOption_EnablePassportAuthentication
WinHttpRequestOption_MaxAutomaticRedirects
WinHttpRequestOption_MaxResponseHeaderSize
WinHttpRequestOption_MaxResponseDrainSize
WinHttpRequestOption_EnableHttp1_1
WinHttpRequestOption_EnableCertificateRevocationCheck
End Enum

Public Function DoLogin()
Dim oReq As WinHttpRequest, uMsg$
Set oReq = New WinHttp.WinHttpRequest

Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1

oReq.Option(WinHttpRequestOption_EnableHttpsToHttpRedirects) = CVar
(True) 'added to see if prob fixed:not fixed
oReq.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300 'added
to see if prob fixed:not fixed

oReq.Open "GET", "http://hiveminder.com/=/action/BTDT.Action.Login",
False
'oReq.setRequestHeader "Cookie", "JIFTY_SID_HIVEMINDER=$COOKIE"
oReq.send
'Debug.Print oReq.getAllResponseHeaders
'Debug.Print oReq.responseText

With oReq
.Open "post", "http://hiveminder.com/=/action/BTDT.Action.Login",
False
.setRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
.SetCredentials "mye...@gmail.com", "mypassword",
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
uMsg = "address=mye...@gmail.com&password=mypassword"
.send uMsg
Debug.Print oReq.statusText
Debug.Print oReq.getAllResponseHeaders
Debug.Print oReq.responseText
End With
End Function

'http.setRequestHeader "Cookie", "JIFTY_SID_HIVEMINDER=$COOKIE"
' may need to duplicate to get around bug
' .setRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
' .setRequestHeader "Content-Type", "multipart/form-data"
' uMsg = uMsg & "&J:A:F:F-remember-
auto-69933bbaccf747a70b9ac88281ba64bd-1=0"
' uMsg = uMsg & "&remember=1"
' uMsg = uMsg & "&token="

I would appreciate any help. I a new REST user and am not that
familiar with HTTP and surrounding protocols.

Jesse Vincent

unread,
Jan 19, 2009, 9:36:28 AM1/19/09
to hivemin...@googlegroups.com


On Fri, Jan 16, 2009 at 12:05:08PM -0800, dhfan2 wrote:
>
> I'm trying to use the winhttp COM component from Excel to login into
> hiveminder.com, but haven't succeeded yet.
>
> Before trying to debug why I can't login, I've noticed a discrepancy.
> Firefox returns a simpler HTML page and IE seems to redirect when I
> just manually enter "http://hiveminder.com/=/action/BTDT.Action.Login"
> into each browser. I'm using the latest browsers on MS Vista Business
> 32.

Hm. Can you use a tool like wireshark to see what each browser is
seeing/doing?


> I'm trying to automate the retrieval and posting of tasks using the HM
> API. So far, this is what I have in my VBA module:

Sadly, I know nothing of VBA

Reply all
Reply to author
Forward
0 new messages