PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV 25
→
Wx - Download de Arquivo via http (httprequest)
Wx - Download de Arquivo via http (httprequest)
Started by adrianoboller, Mar., 14 2016 12:11 AM - No answer
Connect yourself…
adrianoboller
#1
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on March, 14 2016 - 12:11 AM
Prezados,
Segue codigo Enviado pelo Marcos Roberto de Gurupi - TO:
Procedure
DownloadArq
(
fArq
,
fArqDestino
)
OK is
boolean
Retorno is
string
OK
=
HTTPRequest
(
fArq
)
IF
OK
=
True
THEN
Retorno
=
HTTPGetResult
(
httpResult
)
ELSE
Info
(
"Erro de endereco da pagina. "
+
fArq
,
ErrorInfo
(
)
)
RESULT
(
False
)
END
//Verifica se existe o arq
IF
PositionOccurrence
(
Retorno
,
"Encontrada"
,
firstRank
,
FromBeginning
) =
0
IF
OK
=
True
THEN
Arquivo is Buffer
=
HTTPGetResult
(
httpResult
)
IF
InSimulatorMode
(
) =
True
IF
fDirectoryExist
(
gpastapro
) =
False
OK
=
fMakeDir
(
gpastapro
)
IF
OK
=
False
Error
(
"Não foi possivel criar o diretorio."
+
CR
+
ErrorInfo
(
)
)
END
END
IF
fFileExist
(
gpastapro
+
fArqDestino
)
THEN
fDelete
(
gpastapro
+
fArqDestino
)
END
OK
=
fSaveBuffer
(
gpastapro
+
fArqDestino
,
Arquivo
)
ELSE
IF
fDirectoryExist
(
gpastapro
) =
False
OK
=
fMakeDir
(
gpastapro
)
IF
OK
=
False
Error
(
"Não foi possivel criar o diretorio."
+
CR
+
ErrorInfo
(
)
)
END
END
IF
fFileExist
(
gpastapro
+
fArq
)
THEN
fDelete
(
gpastapro
+
fArq
)
END
OK
=
fSaveBuffer
(
gpastapro
+
fArqDestino
,
Arquivo
)
END
IF
OK
=
True
THEN
OK
=
fFileExist
(
gpastapro
+
fArqDestino
)
IF
OK
=
True
THEN
HourGlass
(
False
)
ToastDisplay
(
"Download do arquivo "
+
fArqDestino
+
" efetuado com sucesso!"
,
toastShort
,
vaMiddle
,
haCenter
)
RESULT
(
True
)
ELSE
HourGlass
(
False
)
Error
(
"Nao foi possivel encontrar o arquivo "
+
fArqDestino
+
" . "
+
ErrorInfo
(
errMessage
)
)
RESULT
(
False
)
END
ELSE
HourGlass
(
False
)
Error
(
"Nao foi possivel efetuar o download do "
+
fArqDestino
+
". "
+
ErrorInfo
(
errMessage
)
)
RESULT
(
False
)
END
ELSE
HourGlass
(
False
)
Error
(
"URL nao encontrado para download do "
+
fArqDestino
+
" "
+
ErrorInfo
(
errMessage
)
)
RESULT
(
False
)
END
ELSE
Info
(
"Página não encontrada. "
,
fArq
)
END
HourGlass
(
False
)
RESULT
(
True
)
Bons estudos!!!!
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Report
0
0
→ Go back to WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text