Code: Alles auswählen
;by Darkdragon
#TIMEOUT=1500
InitNetwork()
Procedure.s ReceiveLine(ConnectionID)
Text.s = ""
While char.b <> #LF
char = 0
ReceiveNetworkData(ConnectionID, @char, 1)
If char <> 0
Text.s + Chr(char)
EndIf
Wend
ProcedureReturn RemoveString(RemoveString(Text, #CR$), #LF$)
EndProcedure
Procedure HTTPRequest(URL.s, *EndSize.LONG, PacketSize, *Callback)
Protected Size.l, Data_.s, s.l, Method.s, File.s, Content.s, Text.s, Length.l, Line.s
Protected CurSize.l, oSize.l, t.l, ConnectionID.l
If Left(URL, 7) = "http://" : URL = Right(URL, Len(URL)-7) : EndIf
s = FindString(URL, "/", 1)
Host.s = "" : File.s = ""
If s <> 0 : Host.s = Left(URL, s-1) : File.s = Right(URL, Len(URL)-s) : Else : Host = URL : EndIf
s = FindString(File, "?", 1)
If s <> 0
Method.s = "POST"
Content.s = Right(File, Len(File)-s)
File = Left(File, s-1)
Else
Method.s = "GET"
Content.s = ""
EndIf
ConnectionID = OpenNetworkConnection(Host, 80)
If ConnectionID
Data_.s = Method+" /"+File+" HTTP/1.1"+#CRLF$
Data_.s + "Host: "+Host+#CRLF$
Data_.s + "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"+#CRLF$
If Content <> ""
Data_.s + "Connection: close"+#CRLF$
Data_.s + "Content-Type: application/x-www-form-urlencoded"+#CRLF$
Data_.s + "Content-Length: "+Str(Len(Content))+#CRLF$
Data_.s + #CRLF$ + Content.s + #CRLF$+#CRLF$
Else
Data_.s + "Connection: close"+#CRLF$+#CRLF$
EndIf
SendNetworkString(ConnectionID, Data_)
While NetworkClientEvent(ConnectionID) <> 2 : Delay(10) : Wend
Length = 0
Line.s = ""
Repeat
Line = ReceiveLine(ConnectionID)
Debug Line.s
Select LCase(StringField(Line, 1, ":"))
Case "content-length"
Length = Val(Trim(StringField(Line, 2, ":")))
EndSelect
Until Len(Trim(Line)) <= 4
Size = 0
If Length <> 0
*Result = AllocateMemory(Length)
While Size < Length
If CurSize > 0
Size + CurSize
If *Callback
CallFunctionFast(*Callback, Size, Length)
EndIf
EndIf
If Size > (Length-PacketSize)
PacketSize = Length-Size
EndIf
If PacketSize > 0
CurSize = ReceiveNetworkData(ConnectionID, *Result+Size, PacketSize)
EndIf
Wend
FLENGHT.l=Length.l
Else
*Buffer = AllocateMemory(PacketSize)
*Result = AllocateMemory(1)
t = ElapsedMilliseconds()
While ElapsedMilliseconds()-t <= #TIMEOUT
If NetworkClientEvent(ConnectionID) = 2
CurSize = ReceiveNetworkData(ConnectionID, *Buffer, PacketSize)
If CurSize > 0
oSize = Size
Size + CurSize
*Result = ReAllocateMemory(*Result, Size)
CopyMemory(*Buffer, *Result+oSize, CurSize)
If *Callback
CallFunctionFast(*Callback, Size, 0)
EndIf
EndIf
t = ElapsedMilliseconds()
EndIf
Wend
Length = Size
EndIf
*EndSize\l = Length
If *Callback
CallFunctionFast(*Callback, Size, Length)
EndIf
CloseNetworkConnection(ConnectionID)
ProcedureReturn *Result
EndIf
EndProcedure
URL.s = "http://polarwolf.eu/Login.php"
email.s = "test@test.de"
password.s = "test"
*mem=HTTPRequest(URL.s+"?email="+Email.s+"&password="+password.s+"&login=Einloggen", @Size, 16, 0)
If *mem
RecivedHTML.s=PeekS(*mem, Size)
Debug RecivedHTML.s
EndIf
versuch nächstes mal bitte die boardsuche zu verwenden..