Page 2 of 2
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 4:41 am
by AIDA
AIDA wrote:AIDA wrote:Ya encontré lo que atora al programa es esto que uso para sacar la IP
ippub:= PublicIP()
si quito el PublicIP() ya no se atora
por que pasara esto y como remediarlo?

sera culpa del windos 11
Code: Select all | Expand
//**************************************************************
Function PublicIP()
Local cBuffer, cRequest, cResponse, nBytes, pSocket
INetInit()
pSocket := INetConnect( "checkip.dyndns.org", 80 )
IF INetErrorCode( pSocket ) <> 0
? "Socket error:", INetErrorDesc( pSocket )
INetCleanUp()
QUIT
ENDIF
nBytes := INetSend( pSocket, "GET / HTTP/1.1" + CRLF + "Host: checkip.dyndns.org" + CRLF + "User-Agent: HTTP-Test-Program" + CRLF + CRLF )
cBuffer := Space(512)
cResponse:= ""
WHILE ( nBytes > 0 )
nBytes := INetRecv( pSocket, @cBuffer )
cResponse += Left( cBuffer, nBytes )
cBuffer := Space(512)
ENDDO
INetClose( pSocket )
INetCleanUp()
Return( allTrim( substr( substr( cResponse, rat( "<body>", cResponse ) + 26 ), 1, At( "<", substr( cResponse, rat( "<body>", cResponse ) + 26 ) ) - 1 ) ) )
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 5:00 am
by AIDA
el problema sera lo que comenta Rick Lipkin

Una respuesta un poco remota... muchas aplicaciones en la nube, Att.net, Google.cm... consideran ciertas aplicaciones como "menos seguras" y tienes que generar una contraseña segura especial antes de que tu aplicación se conecte...
https://support.google.com/accounts/ans ... 0255?hl=es
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 5:16 am
by AIDA
Hello Rick Lipkin
I did what you recommended and if you were right I generated a key with the name of my application and it finally works correctly
but this will have to be done by each user who acquires my program
https://support.google.com/accounts/answer/185833?hl=es-419Rick Lipkin wrote:Aida
Kinda a long shot answer ... many cloud applications, Att.net, Google.cm .. consider certain apps as "less secure" and you have to generate a special secure password before your application will connect ..
https://support.google.com/accounts/ans ... 0255?hl=enJust my 2 cents worth ..
Rick Lipkin
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 7:39 am
by Antonio Linares
Aida,
Para obtener tu IP pública llama a esta URL:
https://www.fivetechsoft.com/getip.php
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 7:50 am
by Antonio Linares
En este ejemplo de mod_harbour tienes el código que necesitas. Posiblemente hay formas aún más sencillas de hacerlo

callphp.prg
Code: Select all | Expand
#ifdef __PLATFORM__WINDOWS
#include "c:\harbour\contrib\hbcurl\hbcurl.ch"
#else
#include "/usr/include/harbour/hbcurl.ch"
#endif
function Main()
curl_global_init()
? "Hello world"
? callPHP( "www.fivetechsoft.com/getip.php" )
curl_global_cleanup()
return nil
function callPHP( cUrl )
local hCurl, uValue
if ! empty( hCurl := curl_easy_init() )
curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
if curl_easy_perform( hCurl ) == 0
uValue = curl_easy_dl_buff_get( hCurl )
endif
endif
return uValue
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 7:59 am
by Antonio Linares
Aida,
Más simple:
Code: Select all | Expand
function Main()
MsgInfo( WebPageContents( "http://www.fivetechsoft.com/getip.php" ) )
return nil
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 7:59 pm
by AIDA
Super

si funciona y el malvado

google ya no bloquea la aplicación
Code: Select all | Expand
ippub:= WebPageContents( "http://www.fivetechsoft.com/getip.php" )
Muchas gracias
seguimos en contacto y dando lata
Saluditos
Antonio Linares wrote:Aida,
Más simple:
Code: Select all | Expand
function Main()
MsgInfo( WebPageContents( "http://www.fivetechsoft.com/getip.php" ) )
return nil
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 8:35 pm
by Antonio Linares
Code: Select all | Expand
function FW_PublicIP()
return WebPageContents( "http://www.fivetechsoft.com/getip.php" )
Re: Aviso que el servidor de SQL esta caído
Posted: Tue Jan 18, 2022 11:57 pm
by cnavarro
Code: Select all | Expand
function GetWebIp
local cReturn
local xmlhttp
xmlhttp := win_oleCreateObject( "MSXML2.ServerXMLHTTP" )
xmlhttp:Open( "GET", "http://dynupdate.no-ip.com/ip.php", .F. )
Try
xmlhttp:Send()
cReturn := xmlhttp:responseBody
Catch
cReturn := "0.0.0.0"
End
xmlhttp := nil
return cReturn