Boolean: ReLoad
https://boolean.forumenko.com/

Скачка файла
https://boolean.forumenko.com/topic11.html
Страница 1 из 1

Автор:  impersonalis [ 11-02, 00:04 ]
Заголовок сообщения:  Скачка файла

Код:
;|------------------------------------------------------|
;| ?2006 by www.Marius-Rabung.de | mail@marius-rabung.de|
;|------------------------------------------------------|

Function Download(Inputfile$,outputfile$, Port%=80)

 Local host$
 Local host_tmp
 Local stream
 Local file

;------------------------------- Den Host aus InputFile$ rausfiltern
 host$=right(inputfile$,len(inputfile$)-7) ; http:// rausschneiden
 host_tmp=instr(host$,"/")-1               ; Das erste Slash im String suchen und 1 abziehen
 host$=left(host$,host_tmp)                ; Den Text bis zu dem ersten Slash-1 k?rzen
 ;------------------------------ TCPStream zum Host ?ffnen
 stream = OpenTCPStream(host$,Port%)
;------------------------------- Datei Anfordern
 WriteLine stream, "GET "+Inputfile$+ " HTTP/1.1"
 WriteLine stream, "Host: "+host$
 WriteLine stream, ""
;------------------------------- Datei auf der Festplatte erstellen
 file = writeFile(outputfile$)
;------------------------------- Das Ende des HTTP Headers suchen
 For a=0 To 100
  tmp$=ReadLine(stream)
  If Instr(Lower$(tmp), "content-type")>0 Then ReadLine(stream) : Exit
 Next
;------------------------------- Datei downloaden
 While Not Eof(stream)       
  WriteByte file, ReadByte(stream)   
 Wend
;------------------------------- Alles wieder Schlie?en
 CloseFile file
 CloseTCPStream stream
End Function


Код:
Download("http://mariusrabung.ma.funpic.de/Temp/Download.bb", "C:/Download.bb")

Страница 1 из 1 Часовой пояс: UTC + 3 часа
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/