I think if you watch at these funktions and know a bit how it woks with packets you schould understand it.
You just try to rebuild the packet. If you got a GET packet set the parameter $sPost to a empty string. You also need to get the cookies. When you send the first GET packet you should get the cookies. They are in the source, the return of TCPRequest. You get the cookies by using the GetCookies funktion. From now you need to set the cookies in TCPRequest.
Just try it a bit and show the return in a MsgBox to see if you created a packet succesfull.
PHP Code:
#include<String.au3>
Func GetCookies($sQuellcode)
Local $sCookies, $i, $aCookies
$sCookies = ''
$aCookies = _StringBetween($sQuellcode, 'Set-Cookie: ', ';', 1)
For $i = 0 To UBound($aCookies) - 1
$sCookies &= $aCookies[$i] & ';'
Next
Return $sCookies
EndFunc ;==>GetCookies
Func TCPRequest($sIp, $sHost,$msg=0, $sSeite = "", $sPost = '', $sCookies = '', $sReferer = '', $iMaxTime = 10000)
Local $sPacket, $iSocket, $iTimer
If $sPost = '' Then
$sPacket = 'GET /' & $sSeite & ' HTTP/1.1' & @CRLF
Else
$sPacket = 'POST /' & $sSeite & ' HTTP/1.1' & @CRLF
EndIf
$sPacket &= 'Host: ' & $sHost & @CRLF & _
'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)' & @CRLF & _
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' & @CRLF & _
'Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3' & @CRLF & _
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' & @CRLF & _
'Keep-Alive: 300' & @CRLF & _
'Content-Type: application/x-www-form-urlencoded' & @CRLF & _
'Connection: keep-alive' & @CRLF
If $sReferer <> '' Then
$sPacket &= 'Referer: ' & $sReferer & @CRLF
EndIf
If $sCookies <> '' Then
$sCookies=StringStripCR($sCookies)
$sCookies=StringStripWS($sCookies,8)
$sPacket &= 'Cookie: ' & $sCookies & @CRLF
EndIf
If $sPost <> '' Then
$sPacket &= 'Content-Length: ' & StringLen($sPost) & @CRLF
EndIf
$sPacket &= @CRLF
If $sPost <> '' Then
$sPacket &= $sPost
EndIf
If $msg=1 Then
MsgBox(0,"Packet",$sPacket)
EndIf
TCPStartup()
If @error Then Return SetError(1, 0, "")
$iSocket = TCPConnect($sIp, 80)
If @error Then Return SetError(2, 0, "")
TCPSend($iSocket, $sPacket)
If @error Then Return SetError(3, 0, "")
$iTimer = TimerInit()
Do
$sRecv = TCPRecv($iSocket, 1024)
If TimerDiff($iTimer) > $iMaxTime Then Return SetError(4, 0, "")
Until $sRecv <> ""
Do
$sRecv &= TCPRecv($iSocket, 1024)
Until @error Or StringInStr($sRecv, '</html>')
TCPCloseSocket($iSocket)
TCPShutdown()
Return $sRecv
EndFunc ;==>TCPRequest
Func Change($string)
$string = StringReplace($string, "%", "%25")
$string = StringReplace($string, "†", "%E2%80%A0")
$string = StringReplace($string, "ä", "%C3%A4")
$string = StringReplace($string, "ö", "%C3%B6")
$string = StringReplace($string, "ü", "%C3%BC")
$string = StringReplace($string, "!", "%21")
$string = StringReplace($string, '"', "%22")
$string = StringReplace($string, "§", "%C2%A7")
$string = StringReplace($string, "$", "%24")
$string = StringReplace($string, "&", "%26")
$string = StringReplace($string, "/", "%2F")
$string = StringReplace($string, "+", "%2B")
$string = StringReplace($string, " ", "+")
$string = StringReplace($string, "(", "%28")
$string = StringReplace($string, ")", "%29")
$string = StringReplace($string, "=", "%3D")
$string = StringReplace($string, "?", "%3F")
$string = StringReplace($string, "[", "%5B")
$string = StringReplace($string, "]", "%5D")
$string = StringReplace($string, "{", "%7B")
$string = StringReplace($string, "}", "%7D")
$string = StringReplace($string, "ß", "%C3%9F")
$string = StringReplace($string, ",", "%2C")
$string = StringReplace($string, ":", "%3A")
$string = StringReplace($string, ";", "%3B")
$string = StringReplace($string, "#", "%23")
$string = StringReplace($string, "~", "%7E")
$string = StringReplace($string, "²", "%C2%B2")
$string = StringReplace($string, "³", "%C2%B3")
$string = StringReplace($string, "<", "%3C")
$string = StringReplace($string, ">", "%3E")
$string = StringReplace($string, "|", "%7C")
$string = StringReplace($string, "^", "%5E")
$string = StringReplace($string, "°", "%C2%B0")
$string = StringReplace($string, "´", "%C2%B4")
$string = StringReplace($string, "@", "%40")
$string = StringReplace($string, "€", "%E2%82%AC")
Return $string
EndFunc ;==>Change