Page 1 of 1

TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Fri Sep 08, 2023 12:05 pm
by jnavas
Saludos,
Esta funcionalidad funciona (lectura del valor del Dólar en el BCV) en diversos usuarios en otras plataformas (redes), en un usuario específico devuelve NOCONNET, agradecemos sugerencias para resolver esta incidencia.
Code: Select all  Expand view

FUNCTION WebPageSource(cUrl)
   local oIE,cTXT,cHTML,cMemo:=""
   local cString
   LOCAL cString1,cString2
   LOCAL oUrl, oCli,lOk

   DEFAULT cUrl := "https://www.bcv.org.ve"

   BEGIN SEQUENCE

        oUrl = TUrl():New( cUrl )

        IF EMPTY( oUrl )
            BREAK
        ENDIF

        oCli = TIPClientHttp():New( oUrl )

        IF EMPTY( oCli )
           BREAK
        ENDIF

        IF !oCli:Open( oUrl )
           BREAK
        ENDIF

        WHILE .T.

          cString := oCli:Read()

          IF Empty(cString)
            EXIT
          ENDIF

          cMemo:=cMemo+cString

        ENDDO

        cString:=cMemo
        oCli:Close()
        oUrl:Close()

    END SEQUENCE

    //MEMOWRIT("BCV.TXT",cMemo)
    //MsgInfo( cString )
    // MemoEdit( cString )

return cString

 

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Mon Sep 11, 2023 5:19 pm
by elmoiquique
Hola


Cuales son las librerias que estas usando

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Tue Sep 12, 2023 6:30 am
by jnavas
echo %fwh%\lib\libcurl.lib + >> b32.bc

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Wed Sep 27, 2023 11:05 pm
by sysctrl2
El antivirus puede ser? :roll:

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Wed Sep 27, 2023 11:08 pm
by sysctrl2
y si pruebas de otro modo?
Code: Select all  Expand view
  Try

      oHttp := CreateObject("winhttp.winhttprequest.5.1")
      oHttp:Open("GET","https://www.bcv.org.ve",.f.)
      oHttp:Send()
      cResp := oHttp:ResponseText()
   Catch
      MsgStop( "Error" )
      Return cResp
   End Try
 

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Thu Sep 28, 2023 8:08 am
by nageswaragunupudi
Esta funcionalidad funciona (lectura del valor del Dólar en el BCV) en diversos usuarios en otras plataformas (redes), en un usuario específico devuelve NOCONNET, agradecemos sugerencias para resolver esta incidencia.

Could be internet problem with that client.

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Thu Sep 28, 2023 8:10 am
by nageswaragunupudi
sysctrl2 wrote:y si pruebas de otro modo?
Code: Select all  Expand view
  Try

      oHttp := CreateObject("winhttp.winhttprequest.5.1")
      oHttp:Open("GET","https://www.bcv.org.ve",.f.)
      oHttp:Send()
      cResp := oHttp:ResponseText()
   Catch
      MsgStop( "Error" )
      Return cResp
   End Try
 


This entire code can be replaced by a single line code, using FWH built-in function:
Code: Select all  Expand view
cText := WebPageContents( "https://www.bcv.org.ve" )

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Thu Sep 28, 2023 8:14 am
by nageswaragunupudi
This is a short code:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local cText, cCur
   local aRates   := {}

   cText    := WebPageContents( "https://www.bcv.org.ve/" )
   for each cCur in { "EUR", "CNY", "TRY", "RUB", "USD" }
      AAdd( aRates, GetRate( cCur, cText ) )
   next
   XBROWSER aRates SETUP oBrw:aCols[ 2 ]:cEditPicture := "999.999999"

return nil

static function GetRate( ccur, cText )

   local aRate  := { cCur, 0 }
   local c, n

   if ( n := At( cCur, cText ) ) > 0
      c     := SubStr( cText, n, 200 )
      c     := AllTrim( AfterAtNum( "<strong>", BeforAtNum( "</strong>", c, 1 ) ) )
      c     := CharRepl( ",", c, "." )
      aRate[ 2 ]  := Val( c )
   endif

return aRate


Result:
Code: Select all  Expand view
+---+-----------+
|EUR|36.02077617|
|CNY| 4.68545827|
|TRY| 1.25422399|
|RUB| 0.35547840|
|USD|34.25070000|
+---+-----------+

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Thu Sep 28, 2023 1:14 pm
by acuellar
Excelent!! Mr Rao

Everyday you learn something new :D

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Thu Sep 28, 2023 3:48 pm
by sysctrl2
Mr Rao Tanks :o

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Fri Sep 29, 2023 4:41 pm
by jnavas
Saludos y agradecido por su apoyo,
Estaré experimentando esta implementación en el usuario donde no se puede ejecutar la pagina web.

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Fri Jan 05, 2024 1:57 pm
by jnavas
Saludos y agradecidos por su aporte, a continuación el codigo que me funcionado, sin embargo aleatoriamente genera incidencia, considero que la página tiene alto tráfico debido a que es utilizada en venezuela por la actividad comercial debido a que nuestra economia esta dolarizada.

Error WinHttp.WinHttpRequest/-1 El dato necesario para completar esta operación no está disponible todavía.
https://learn.microsoft.com/es-es/windo ... inhttp-5-1
otras literaturas. https://stackoverflow.com/questions/773 ... tion-401-a

Code: Select all  Expand view

   oHttp:Open("GET","https://www.bcv.org.ve",.f.)
    oHttp:Send()
    cMemo:= oHttp:ResponseText()
 

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Fri Jan 05, 2024 3:31 pm
by jnavas
Saludos,
Estoy experimentado el siguiente codigo, y no me genera incidencia, esto sucede mayormente 8am, local cuando los comercios estan leyendo el valor del U$S.

Code: Select all  Expand view

    oHttp:Open("GET","https://www.bcv.org.ve",.f.)
    oHttp:SetTimeouts(0, 60000, 30000, 120000) // https://www.autohotkey.com/boards/viewtopic.php?t=9136
    oHttp:Send()
    oHttp:WaitForResponse(90)
    cMemo:= oHttp:ResponseText()

 

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Tue Jan 09, 2024 6:14 pm
by CARLOS ATUNCAR
nageswaragunupudi wrote:This is a short code:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local cText, cCur
   local aRates   := {}

   cText    := WebPageContents( "https://www.bcv.org.ve/" )
   for each cCur in { "EUR", "CNY", "TRY", "RUB", "USD" }
      AAdd( aRates, GetRate( cCur, cText ) )
   next
   XBROWSER aRates SETUP oBrw:aCols[ 2 ]:cEditPicture := "999.999999"

return nil

static function GetRate( ccur, cText )

   local aRate  := { cCur, 0 }
   local c, n

   if ( n := At( cCur, cText ) ) > 0
      c     := SubStr( cText, n, 200 )
      c     := AllTrim( AfterAtNum( "<strong>", BeforAtNum( "</strong>", c, 1 ) ) )
      c     := CharRepl( ",", c, "." )
      aRate[ 2 ]  := Val( c )
   endif

return aRate


Result:
Code: Select all  Expand view
+---+-----------+
|EUR|36.02077617|
|CNY| 4.68545827|
|TRY| 1.25422399|
|RUB| 0.35547840|
|USD|34.25070000|
+---+-----------+



Con version trabaja este ejemplo ?

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

PostPosted: Wed Jan 10, 2024 5:56 am
by nageswaragunupudi
Con version trabaja este ejemplo ?

All versions from 1701 onwards. (from year 2017 onwards)