Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making two request to site with wwHTTP or other
Message
From
30/03/2012 14:49:23
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
Making two request to site with wwHTTP or other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01539858
Message ID:
01539858
Views:
125
I tried to make two requests to site using code below, fiddler is uses as debugging proxy.
First call is login call which sets cookie for other requests. So same connection should used.

Second HttpGetEx in code below returns

error 6: HttpOpenRequest: Win32 API: The handle is invalid.

How to make second call to the same web site ?
SET PROCEDURE TO wwUTILS,wwHTTP ADDITIVE
loHTTP = CREATEOBJECT("wwHttp")
loHTTP.nHTTPConnectType = 3
loHTTP.cHTTPProxyName = "127.0.0.1:8888"
loHTTP.HTTPConnect('service.com','','', .T.)

IF loHTTP.nError#0
  ERROR
  ENDIF

cRes = m.tempdir+SYS(2015)+'.html'
loHTTP.HTTPGetEx("cas/login", '',0, '', m.cRes)

IF loHTTP.nError#0 OR EMPTY(loHTTP.cHTTPHeaders)
  MESSAGEBOX( 'login error ' + TRANSFORM(loHTTP.nerror)+': '+loHTTP.cerrormsg )
  endif

cRes = m.tempdir+SYS(2015)+'.html'
loHTTP.HTTPGetEx("/jsp/myserv.jsp?il=19738233", '',0, ;
'' ;
;
, m.cRes )

IF loHTTP.nError#0 OR EMPTY(loHTTP.cHTTPHeaders)
  * todo: why this returns error 6: HttpOpenRequest: Win32 API: The handle is invalid.
  MESSAGEBOX( 'error ' + TRANSFORM(loHTTP.nerror)+': '+loHTTP.cerrormsg )
  loHTTP.HTTPClose()
  return
  endif
MODIFY FILE (cRes)
Andrus
Reply
Map
View

Click here to load this message in the networking platform