Download gdrive file without using the APIs
http://forums.fivetechsupport.com/viewt ... 73#p209084
Moderador: Moderadores
cUrl := "https://docs.google.com/uc?export=download&id=YOUR_ID_OF_FILE"
//----------------------------------------------------------------------------//
//
// Function para descargar ficheros desde GDrive
// El truquillo está en la dirección de la descarga, el resto es trivial
//
// The ID of the file you get in the address offered by GMail when sharing the file.
// Just change the access address and add that ID
//
// https://docs.google.com/uc?export=download&id=
//----------------------------------------------------------------------------//
// #include "Fivewin.ch"
#include "hbgtinfo.ch"
#include "hbcompat.ch"
#include "hbwin.ch"
#include "xhb.ch"
#require "hbmisc"
Function Main()
local cUrl
//
cUrl := "https://drive.google.com/file/d/15PqoT5QTYRcDGpq8GE80Ddfkss0-MIOi/view?usp=sharing"
Cn_DownLoad( cUrl, .F., "c:\hmg0409\ftp\Personal.dbf" )
//
Return nil
//----------------------------------------------------------------------------//
Function Cn_DownLoad( cUrl, lText, cFileTarget )
local oHttp
local cContents := ""
HB_DEFAULT(@cUrl ,"" )
HB_DEFAULT(@lText ,.F.)
HB_DEFAULT(@cFileTarget, "")
altd()
if !Empty( cUrl )
CallDll32( "wininet.dll", "DeleteUrlCacheEntryA", cUrl )
TRY
// oHttp := FWGetOleObject( "MSXML2.ServerXMLHTTP.3.0" )
oHttp := CreateObject( "MSXML2.ServerXMLHTTP.3.0" )
oHttp:Open( "GET", cUrl, .F. )
oHttp:Send()
oHttp:WaitForResponse()
HB_DEFAULT(@lText, .F.)
if lText
cContents := oHttp:ResponseText()
else
cContents := oHttp:ResponseBody()
endif
CATCH
END
if Len( cContents ) > 0 .and. !Empty( cFileTarget )
MemoWrit( cFileTarget, cContents )
else
Alert( "Erro no Download", "Atenção" )
endif
else
Alert( "URL Informada em branco", "Erro no Download" )
endif
Return nil
Pessoal o Google drive vai continuar ativo até quando alguém sabe?
Usuários vendo este fórum: Nenhum usuário registrado online e 16 visitantes