TUrl()/TIPClientHttp() devuelve NOCONNET

TUrl()/TIPClientHttp() devuelve NOCONNET

Postby jnavas » Fri Sep 08, 2023 12:05 pm

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

 
User avatar
jnavas
 
Posts: 472
Joined: Wed Nov 16, 2005 12:03 pm
Location: Caracas - Venezuela

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby elmoiquique » Mon Sep 11, 2023 5:19 pm

Hola


Cuales son las librerias que estas usando
Fivewin 11.07
elmoiquique
 
Posts: 297
Joined: Wed May 16, 2007 9:40 pm
Location: Iquique Chile

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby jnavas » Tue Sep 12, 2023 6:30 am

echo %fwh%\lib\libcurl.lib + >> b32.bc
User avatar
jnavas
 
Posts: 472
Joined: Wed Nov 16, 2005 12:03 pm
Location: Caracas - Venezuela

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby sysctrl2 » Wed Sep 27, 2023 11:05 pm

El antivirus puede ser? :roll:
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 951
Joined: Mon Feb 05, 2007 7:15 pm

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby sysctrl2 » Wed Sep 27, 2023 11:08 pm

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
 
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 951
Joined: Mon Feb 05, 2007 7:15 pm

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby nageswaragunupudi » Thu Sep 28, 2023 8:08 am

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby nageswaragunupudi » Thu Sep 28, 2023 8:10 am

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" )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby nageswaragunupudi » Thu Sep 28, 2023 8:14 am

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|
+---+-----------+
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby acuellar » Thu Sep 28, 2023 1:14 pm

Excelent!! Mr Rao

Everyday you learn something new :D
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby sysctrl2 » Thu Sep 28, 2023 3:48 pm

Mr Rao Tanks :o
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 951
Joined: Mon Feb 05, 2007 7:15 pm

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby jnavas » Fri Sep 29, 2023 4:41 pm

Saludos y agradecido por su apoyo,
Estaré experimentando esta implementación en el usuario donde no se puede ejecutar la pagina web.
User avatar
jnavas
 
Posts: 472
Joined: Wed Nov 16, 2005 12:03 pm
Location: Caracas - Venezuela

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby jnavas » Fri Jan 05, 2024 1:57 pm

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()
 
User avatar
jnavas
 
Posts: 472
Joined: Wed Nov 16, 2005 12:03 pm
Location: Caracas - Venezuela

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby jnavas » Fri Jan 05, 2024 3:31 pm

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()

 
User avatar
jnavas
 
Posts: 472
Joined: Wed Nov 16, 2005 12:03 pm
Location: Caracas - Venezuela

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby CARLOS ATUNCAR » Tue Jan 09, 2024 6:14 pm

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 ?
CARLOS ATUNCAR
 
Posts: 117
Joined: Thu Sep 17, 2015 11:40 pm

Re: TUrl()/TIPClientHttp() devuelve NOCONNET

Postby nageswaragunupudi » Wed Jan 10, 2024 5:56 am

Con version trabaja este ejemplo ?

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10247
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 61 guests