Hola buenos días de nuevo
Podemos hacer peticiones de tipo POST desde webview?
Has considerado usar Curl ?
cEp := hb_jsonEncode( RsToHash( oRsEp ) )
cEp := hb_base64encode(cEp,len(cEp))
oWebVwLg := TWebView():New(, oWid:hWnd )
oWebVwLg:Navigate( "https://nuestraurl/index?aep="+cEp ) //ESTA CADENA PUEDE SER DEMASIADO LARGA, "CREO" QUE SI LA ENVIAMOS POR POST NO VAMOS A TENER PROBLEMAS CON EL TAMAÑO
oWebVwLg:SetUserAgent( "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36" )
oWebVwLg:Bind( "SendToFWH" )
oWebVwLg:bOnBind = { | cJson, cCalls | EVAL(cbLog, cJson ) }
STATIC oOle
FUNCTION Main()
LOCAL aRecord, cJson
oOle := Createobject("MSXML2.ServerXMLHTTP")
aRecord := hash()
aRecord["ID"] = 1
aRecord["DATO2"] = "MIDATO2"
aRecord["DATO3"] = "MIDATO3"
cJson := hb_jsonEncode(aRecord,.f.)
SendPostToUrl( "https://nuestraurl/miapi", cJson, "application/json")
oWebVwLg := TWebView():New(, oWid:hWnd )
oWebVwLg:Navigate( "https://nuestraurl/vista?ID="+aRecord["ID"] )
RETURN nil
STATIC Function SendPostToUrl( cUrl, cParams,cContentType,cAuthorization )
Local cRet:="",uRet
default cContentType:="application/json"
default cAuthorization:=""
oOle:Open( 'POST', cUrl, .f. )
oOle:SetRequestHeader( "Content-Type",cContentType)
if !empty(cAuthorization)
oOle:SetRequestHeader( "Authorization",cAuthorization)
end if
oOle:Send( cParams )
//SysRefresh()
cRet:=""
IF !oOle:ResponseBody = NIL
hb_jsonDecode(oOle:ResponseBody,@cRet)
ELSE
cRet := oOle:ResponseText
ENDIF
Return cRet
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 54 guests