Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making two request to site with wwHTTP or other
Message
De
30/03/2012 14:49:23
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Titre:
Making two request to site with wwHTTP or other
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01539858
Message ID:
01539858
Vues:
123
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
Répondre
Fil
Voir

Click here to load this message in the networking platform