Page 1 of 2
GetUrl Library for windows
Posted: Sat May 01, 2004 12:30 pm
by Num3
This new library is available on PureArea.net.
This set of commands is written in 100% PureBasic code, which means it will work under all OS versions of Purebasic that support version 3.90 or superior. For now only the windows version is released.
Linux version is only pending on 3.90 release.
OsX and Amiga will also support this library if they reach 3.90.
Consider this library Beta and unfinished, there is still much work to do
Commands:
GetUrlLastMod(*Struct.filedata)
Retrieves the last modified date of the especified file.
This command is usefull to check if there are any updates on a file
--------------------------------------------------------------------------------
GetUrlFile(*Struct.filedata)
Downloads the especified file. This does not work with php / jsp / perl on-the-fly generated pages, because usually the page file size is not returned
--------------------------------------------------------------------------------
GetUrlProgress()
Posted: Sat May 01, 2004 12:33 pm
by thefool
Posted: Sat May 01, 2004 12:40 pm
by thefool
Thank you very much! Now i dont have to mess with thos OS-specific API codes! Waiting for the geturlsize function or so i can download a file with unknown file-size.
Posted: Sat May 01, 2004 7:52 pm
by dmoc
Looks good Num3! Will it download-to-buffer if no filename supplied?
Posted: Sat May 01, 2004 7:58 pm
by Shopro
Cool Num3:)
Lots of people would use this, probably including me:)
-Shopro
Posted: Sat May 01, 2004 8:05 pm
by ricardo
Excellent!!
Can do more than one download at the same time?
Posted: Sat May 01, 2004 9:35 pm
by Andre
@ricardo: Its already available on PureArea.net, so this shouldn't be a problem...

Posted: Sun May 02, 2004 12:21 am
by ricardo
Andre wrote:@ricardo: Its already available on PureArea.net, so this shouldn't be a problem...

Thanks Andre!
I mean download more than one webpage with this libeary at the same time.
Posted: Sun May 02, 2004 10:39 am
by Num3
Yes you can downladoad several files at once (every time you call the function a thread is created), the only side effect is that the progress call back will return wacky values (because of the several threads).
I intent to solve this later on too

Posted: Sun May 02, 2004 11:37 am
by omid-xp
Thank you Num3 so much for this new library.
It's cool.

Posted: Sun May 02, 2004 1:56 pm
by Flype
hi num3
i've realised a sort of frontend for your lib
this works a treat...
but as you said there's a lot of things to do
if you're agree, it would be good idea to add this features :
DownloadedBytes.l = GetUrlDownloadedSize()
Result.l = GetUrlCancelDownload()
Posted: Sun May 02, 2004 4:06 pm
by Flype
sorry, i just seen in your doc (at the end) that
you are already working on those 2 commands
so good news
..
Posted: Mon May 10, 2004 1:24 am
by NoahPhense
love the lib Num3.. kicks as$. ..
- np
Posted: Wed Dec 08, 2004 7:39 pm
by Andre
Num3, would you create an updated archive of the GetURL lib ?
According to the
thread about the GetURL sourcecode I noticed, that you released the sourcecode in an updated version.
Would be really nice, to have an complete up-to-date userlib archive on PureArea.net again !

Posted: Wed Dec 08, 2004 8:36 pm
by GPI
see here:
viewtopic.php?t=11095
i found severel bugs. The crypted of UserName+Pass is wrong. The error-code-check is wrong (it could happen, that a 404-file not found is detected, when in the tag-string is a "404"), not all errors are detected, use of threads -> unsecure.
And finaly:
With this code you can analyse the date from the server.
Code: Select all
Dim wkday$(6)
Dim weekday$(6)
Dim Month$(12)
wkday$(1)="MON"
wkday$(2)="TUE"
wkday$(3)="WED"
wkday$(4)="THU"
wkday$(5)="FRI"
wkday$(6)="SAT"
wkday$(0)="SUN"
weekday$(1)="MONDAY"
weekday$(0)="TUESDAY"
weekday$(0)="WEDNESDAY"
weekday$(0)="THURSDAY"
weekday$(0)="FRIDAY"
weekday$(0)="SATURDAY"
weekday$(0)="SUNDAY"
Month$(1)="JAN"
Month$(2)="FEB"
Month$(3)="MAR"
Month$(4)="APR"
Month$(5)="MAY"
Month$(6)="JUN"
Month$(7)="JUL"
Month$(8)="AUG"
Month$(9)="SEP"
Month$(10)="OCT"
Month$(11)="NOV"
Month$(12)="DEC"
; 1 2 3 4 5
;TestTime$="Sun, 06 Nov 1994 08:49:37 GMT"
; 1 2 3
;TestTime$="Sunday, 06-Nov-94 08:49:37 GMT"
; 1 2 3 4 5
TestTime$="Sun Nov 6 08:49:37 1994"
TestTime$=ReplaceString(Trim(UCase(TestTime$))," "," ")
Day=0:Month$="":Year=0:Time$=""
For i=0 To 6
If Left(TestTime$,4)=wkday$(i)+","
Debug "rfc1123-Date"
;{
Day=Val(StringField(TestTime$,2," "))
Month$=StringField(TestTime$,3," ")
Year=Val(StringField(TestTime$,4," "))
Time$=StringField(TestTime$,5," ")
;}
ElseIf Left(TestTime$,Len(weekday$(i))+1)=weekday$(i)+","
Debug "rfc850-Date"
;{
SubTime$=StringField(TestTime$,2," ")
Day=Val(StringField(SubTime$,1,"-"))
Month$=StringField(SubTime$,2,"-")
Year=Val(StringField(SubTime$,3,"-"))
If Year>80:Year+1900:Else:Year+2000:EndIf
Time$=StringField(TestTime$,3," ")
;}
ElseIf Left(TestTime$,4)=wkday$(i)+" "
Debug "asctime-Date"
;{
Day=Val(StringField(TestTime$,3," "))
Month$=StringField(TestTime$,2," ")
Year=Val(StringField(TestTime$,5," "))
Time$=StringField(TestTime$,4," ")
;}
EndIf
Next
For i=1 To 12
If Month$(i)=Month$ : Month=i : EndIf
Next
Date=ParseDate("%hh:%ii:%ss",Time$)
Hour=Hour(Date)
Min=Minute(Date)
Sec=Second(Date)
Date=Date(Year,Month,Day,Hour,Min,Sec)
Debug FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss",Date)