http://fivewin.com.br/index.php?/topic/ ... 3%BAblico/
Code: Select all | Expand
// C:\FWH..\SAMPLES\WARTIAG4.PRG
#include "Fivewin.ch"
#include "tip.ch" // ARISTON.PRG
FUNCTION Main()
LOCAL oDlg, oGet
LOCAL cCad := "Testing " // pad("Testing Gets",40)
LOCAL nNum := 0
LOCAL dDat := Date()
inicio := 0
SET CENTURY ON
SET DATE TO BRITISH
SET EPOCH TO 1960
SET Multiple ON
SET DELETED ON
DEFINE DIALOG oDlg TITLE "TGet from " + FWDESCRIPTION
@ 1, 2 SAY "Text..:" OF oDlg
@ 1, 6 GET oGet1 VAR Inicio OF oDlg SIZE 100, 10 COLOR "W/G" PICTURE "99999999"
@ 3, 7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION Averba()
@ 3, 16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
STATIC FUNCTION Averba()
LOCAL oUrl, oCli, url
LOCAL hQUery := Hash()
url := "https://apis.averbeporto.com.br/php/conn.php"
TRY
// oUrl = TUrl():New( 'https://apis.averbeporto.com.br/php/conn.php' )
oUrl := TUrl():New( url ) // From tip.lib
oCli := TipClientHttp():New( oUrl, .f. ) // From tip.lib
// oCli = TIPClientHttp():New( oUrl )
CATCH
MsgInfo('Conection Error','Erro')
RETURN NIL
END
IF .NOT. Empty( oUrl )
// oCli = TIPClientHttp():New( oUrl )
IF .NOT. Empty( oCli )
oCli:nConnTimeout = -1
oCli:lSSL = .T.
IF oCli:Open()
hQuery[ "mod" ] := "login"
hQuery[ "comp" ] := "5"
hQuery[ "user" ] := "xxxxxxxxxxxx"
hQuery[ "pass" ] := "xxxxxxxxxxxx"
oCli:cUserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'
IF !oCli:PostMultiPart( hQuery )
CurSorArrow()
MsgInfo( oCli:lastErrorMessage, 'Error' )
ELSE
cNFSeResp := oCli:ReadAll()
RespC := oCli:GetCookies() // Get cookie
ENDIF
oCli:Close()
ENDIF
ENDIF
ENDIF
msginfo( cNFSeResp )
msginfo( RespC )
RETURN NIL
//--------------------------------------------------------------------------//
DLL Function DeleteUrlCacheEntry(lpszUrlName AS STRING) AS LONG PASCAL FROM "DeleteUrlCacheEntryA" LIB "wininet.dll"
//--------------------------------------------------------------------------//
/* // teste
#include "FiveWin.ch"
#include "tip.ch"
FUNCTION RetPublicIP()
LOCAL cPubIP := "", cxHtml := "", url, oUrl, oHttp, oErr
url := "http://checkip.dyndns.org"
try
oUrl:=TUrl():New( url ) // From tip.lib
oHttp := TipClientHttp():New( oUrl , .f. ) // From tip.lib
catch oErr
? "Erro: "+oErr:Description
end try
Try
oHttp:Open()
cxHtml := oHttp:ReadAll() // Baixa todo o conteúdo do site.
cPubIP := allTrim( substr( substr( cxHtml, rat( "<body>", cxHtml ) + 26 ), 1, At( "<", substr( cxHtml, rat( "<body>", cxHtml ) + 26 ) ) - 1 ) )
catch oErr
? "Erro: "+oErr:Description
End
oHttp:Close()
DeleteUrlCacheEntry(url) // Lipar Cache
? cPubIP
Return Nil
//----------------------------------------------------------------------------------------------------------------------//
DLL Function DeleteUrlCacheEntry(lpszUrlName AS STRING) AS LONG PASCAL FROM "DeleteUrlCacheEntryA" LIB "wininet.dll"
//----------------------------------------------------------------------------------------------------------------------//
*/