
Noobster24
Active Members-
Posts
126 -
Joined
-
Last visited
Noobster24's Achievements

Adventurer (3/7)
0
Reputation
-
P2P-engine for my program
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Well I'm seriously thinking about the p2p-engine for my program. I used to program in PHP, AJAX, XML etc., now I want try this to make this in AutoIt. Thank you for the link, it's useful. -
Hi, In my program users can search certain websites for downloads, this works great. Now I try to create 2 p2p-engine in my program, so that users can search each other shared files. Ofcourse users have agreed to share a map with downloads, so no illegal stuff. I read articles about file-sharing via p2p: http://computer.howstuffworks.com/file-sharing3.htm etc. The Gnutella-network is a good example of what I try to create. In other p2p-programs (limewire, kazaa, napster etc.) it's possible to search for a file and download it. You can download the same file from mulitple seeds (leafs). But how does that work? Via TCPSend it's possible to send files one-to-one. But how is it possbile to use it like four-to-one? For example: #Comp1 has filename.zip #Comp2 has filename.zip #Comp3 has filename.zip #Comp4 has filename.zip #Comp5 searches for 'filename', the results popup in my program: filename.zip with 4 seeds (leafs). #Comp5 double clicks it and starts downloading, how must I code it to download the file from 4 seeds to bring the downloadspeed up?:S My english isn't that well, so I hope you understand it.
-
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
That would be unlogic, because I recieve the correct ResponseHeaders from the request... With this code: $fopen = FileOpen ( @ScriptDir & '\headers.txt', 2 ) $oHTTP = ObjCreate('winhttp.winhttprequest.5.1') $oHTTP.Open('POST', 'http://www.website.com/d.x', 1) $oHTTP.SetRequestHeader('Content-Type','application/x-www-form-urlencoded') $oHTTP.setTimeouts(5000, 5000, 15000, 15000) $oHTTP.Send('ID=N3CRMI8&down_load=Click+here+to+download+the+file') $oHTTP.WaitForResponse FileWrite ( $fopen, $oHTTP.GetAllResponseHeaders() )oÝ÷ ØÞr'¯zØ^±è^i׫²«¨µàÚµäá»MÀ¦½´ÓÍ6ßÝ;ÄÒz»Þ¬ Zr¿ÛNµRx±çAÈñÏÿ¶ íz{CÊh²+b¢wâéÚ The filename.zip is a valid archive with contents. XStandard HTTP Component: http://www.xstandard.com/en/documentation/xhttp/ I rather like to use the wininet.dll, but that doesn't work for me so far. Maybe anyone can see what I'm overlooking all the time? -
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
That would be unlogic, because I recieve the correct ResponseHeaders from the request... With this code: $fopen = FileOpen ( @ScriptDir & '\headers.txt', 2 ) $oHTTP = ObjCreate('winhttp.winhttprequest.5.1') $oHTTP.Open('POST', 'http://www.website.com/d.x', 1) $oHTTP.SetRequestHeader('Content-Type','application/x-www-form-urlencoded') $oHTTP.setTimeouts(5000, 5000, 15000, 15000) $oHTTP.Send('ID=N3CRMI8&down_load=Click+here+to+download+the+file') $oHTTP.WaitForResponse FileWrite ( $fopen, $oHTTP.GetAllResponseHeaders() )ƒoÝŠ÷ ØŠÞr'¯zØ^±è^i׫²«¨µàÚµäá»MÀ¦½´ÓÍ6ßÝ;ÄÒz»Þ¬ Zr¿ÛNµRx±<sÿçm—>ŒçAÈñÏÿ¶ ‰íz{CŠÊh²+b¢wâ•éÚ™ It gives me a valid filename.zip with contents. As you can see at above code the wininet.dll should work too, because I use the same headers and post data. Maybe you can see what I'm doing wrong with wininet.dll? Xstandard HTTP Component: http://www.xstandard.com/en/documentation/xhttp/ I would like to use the wininet.dll because 99,9% of the people have that dll registrerd and installed on their system. If I want to use the XStandard HTTP Component, I have to install + register the dll first. I still don't know what I'm doing wrong when using wininet.dll, I use the same headers, the same postdata, the same PC, etc. -
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
$fopen = FileOpen ( @ScriptDir & '\filename.zip', 18 ) $oHTTP = ObjCreate('winhttp.winhttprequest.5.1') $oHTTP.Open('POST', 'http://www.website.com/d.x', 1) $oHTTP.SetRequestHeader('Content-Type','application/x-www-form-urlencoded') $oHTTP.setTimeouts(5000, 5000, 15000, 15000) $oHTTP.Send('ID=N3CRMI8&down_load=Click+here+to+download+the+file') $oHTTP.WaitForResponse FileWrite ( $fopen, $oHTTP.ResponseText ) If I open the zip with Wordpad / Notepad I still get the first five (5) characters: I uploaded the zip to the forum so that you can check it for yourself. -
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Hi, with this code: $oHTTP = ObjCreate('winhttp.winhttprequest.5.1') $oHTTP.Open('POST', 'http://www.website.com/d.x') $oHTTP.SetRequestHeader('Content-Type','application/x-www-form-urlencoded') $oHTTP.Send('ID=N3CRMI8&down_load=Click+here+to+download+the+file') ConsoleWrite($oHTTP.ResponseText) I get this response back in the console: The same result as I got with wininet.dll... The header that I recieve with above code are correct and the same as with TCP-functions: So, that doesn't work for me either . Got some ideas left?=) -
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Hmm, thanks for the reply. I will try it tomorrow, must go to bed now. -
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Bumpy -
Download zip with WinInet
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Bump, anyone?=) -
Hi, I post some values etc. to a website so that I can download a zip-file. The POST-header: The response headers: If I go to or use InetGet for this location, it gives me a 404-error: http://www.website.com/filename.zip I tried to use the InternetRead function in wininet.dll, but it only gives me back the first 5 characters: Func _InternetRead($l_Request) Global $ai_IRF, $s_Buf = '' Global $v_Struct = DllStructCreate('udword') DllStructSetData($v_Struct, 1, 1) While DllStructGetData($v_Struct, 1) <> 0 $ai_IRF = DllCall($dll, 'int', 'InternetReadFile', 'long', $l_Request, 'str', '', 'int', 128, 'ptr', DllStructGetPtr($v_Struct)) $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1)) WEnd Return $s_Buf EndFunc First 5 bytes: Full 231 bytes: According to HTTPSniffer OSS.exe (I compiled my source and named it OSS.exe) recieved the same amount of bytes as Firefox: 525+231 bytes 231 bytes is the size op the zip-file (I checked it when I downloaded it with Firefox). Why the hell do I only get 5 bytes back and not the 231 I hope (and should recieve, just like Firefox and just like HTTPSniffer tells me)? Or if you got a faster / easier way to download the zip-file trough AutoIt / DLL's etc. tell me please. Thanks in advance, Andreas
-
POST-header then download the zip
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
This script gives me the header I want to recieve, but it's like Mc said with TCP-functions. There must be a way with wininet.dll, right? $sResponse = _HTTPGetResponse("host.com", "/d.php") ConsoleWrite( $sResponse ) Func _HTTPGetResponse($sHost, $sPage) $iSocket = _HTTPConnect($sHost) If @error Then Return SetError(1, 0, "") Local $sCommand = "POST " & $sPage & " HTTP/1.1" & @CRLF $sCommand &= "Host: " & $sHost & @CRLF $sCommand &= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" & @CRLF $sCommand &= "Content-Type: application/x-www-form-urlencoded" & @CRLF $sCommand &= "Content-Length: 57" & @CRLF $sCommand &= "Keep-Alive: 300" & @CRLF $sCommand &= "Accept-Encoding: gzip,deflate" & @CRLF $sCommand &= "Referer: refer.com" & @CRLF $sCommand &= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" & @CRLF $sCommand &= "Accept-Language: nl,en-us;q=0.8,en;q=0.5,de;q=0.3" & @CRLF $sCommand &= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @CRLF $sCommand &= "Connection: keep-alive" & @CRLF & @CRLF $sCommand &= "id=210634&cc=642b877aa7ed95c743ef53b4e6772bb1&sid=bugscrc" & @CRLF Local $BytesSent = TCPSend($iSocket, $sCommand) If $BytesSent = 0 Then Return SetError(2, @error, 0) Local $sRecv = "", $sCurrentRecv While 1 $sCurrentRecv = TCPRecv($iSocket, 256) If @error <> 0 Then ExitLoop If $sCurrentRecv <> "" Then $sRecv &= $sCurrentRecv WEnd TCPCloseSocket($iSocket) TCPShutdown() Return $sRecv EndFunc Func _HTTPConnect($sHost) TCPStartup() Local $sName_To_IP = TCPNameToIP($sHost) Local $iSocket = TCPConnect($sName_To_IP, 80) If $iSocket = -1 Then TCPCloseSocket($iSocket) Return SetError(1, 0, "") EndIf Return $iSocket EndFunc Console-output: Thanks for that, but I prefer the wininet.dll. My search will continue if somebody got an idea, let it know . -
POST-header then download the zip
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
I uploaded two zip-files the script made with FileWrite() etc. I used the latest beta. Fileopen with mode130 (filename-130.zip) $internet = _InternetOpen($number) $internetconnection = _InternetConnect($internet, 'host.com') $request = _HttpOpenRequest($internetconnection, 'POST', '/d.php') $aap = _HTTPQueryInfo($request) _HttpSendRequest($request, 'Content-Type: application/x-www-form-urlencoded', StringLen('Content-Type: application/x-www-form-urlencoded'), 'id=' & $tescrack[0] & '&cc=' & $tescrack[1] & '&sid=' & $tescrack[2], StringLen('id=' & $tescrack[0] & '&cc=' & $tescrack[1] & '&sid=' & $tescrack[2])) $aap = _HTTPQueryInfo($request) $response2 = _InternetRead($request) QuickOutput( @ScriptDir & '\temp\filename.zip', $response2, 130 ) _InternetCloseHandle($internet)ƒoÝŠ÷ ØX¥zŠ^Ÿ†j{gâ•ê)z}³Š–®¶ˆsbb33c¶–çFW&æWBÒô–çFW&æWD÷Vâ‚b33c¶çVÖ&W" ’b33c¶–çFW&æWF6öææV7F–öâÒô–çFW&æWD6öææV7B‚b33c¶–çFW&æWBÂb33“¶†÷7Bæ6öÒb33“² ’b33c·&WVW7BÒô‡GG÷Vå&WVW7B‚b33c¶–çFW&æWF6öææV7F–öâÂb33“µõ5Bb33“²Âb33“²öBç‡b33“² ’b33c¶Òô…EEVW'”–æfò‚b33c·&WVW7B •ô‡GG6VæE&WVW7B‚b33c·&WVW7BÂb33“´6öçFVçBÕG—S¢Æ–6F–öâ÷‚×wwrÖf÷&Ò×W&ÆVæ6öFVBb33“²Â7G&–ætÆVâ‚b33“´6öçFVçBÕG—S¢Æ–6F–öâ÷‚×wwrÖf÷&Ò×W&ÆVæ6öFVBb33“²’Âb33“¶–CÒb33“²fײb33c·FW67&6µ³Òfײb33“²f×¶63Òb33“²fײb33c·FW67&6µ³Òfײb33“²f×·6–CÒb33“²fײb33c·FW67&6µ³%ÒÂ7G&–ætÆVâ‚b33“¶–CÒb33“²fײb33c·FW67&6µ³Òfײb33“²f×¶63Òb33“²fײb33c·FW67&6µ³Òfײb33“²f×·6–CÒb33“²fײb33c·FW67&6µ³%Ò’ ’b33c¶Òô…EEVW'”–æfò‚b33c·&WVW7B ’b33c·&W7öç6S"Òô–çFW&æWE&VB‚b33c·&WVW7B •V–6´÷WGWB‚67&—DF—"fײb33“²b3“#·FV×b3“#¶f–ÆVæÖR禗b33“²Âb33c·&W7öç6S"Â" •ô–çFW&æWD6Æ÷6T†æFÆR‚b33c¶–çFW&æWBoÝ÷ Ùø¥zv¦{]ôÎ*b³^dmø¥zv¦{lâ¦+5ÒFÈñÏÊj{¬zuê÷õÊ'µéí·*^Î*[¦ßÖ§uç!¢Ø^~)^ë¢{^Û®Î*_W¡Ú0ZvØ^Î*üGbµh^¬zØb±Êx¶Ø^±©æz¶ÚrF¬Â+aÂ)âë]V®¶sbb33c¶ôEEÒö&¤7&VFRgV÷C·væGGçvæGG&WVW7BãRãgV÷C²¢b33c¶ôEEä÷VâgV÷Cµõ5BgV÷C²ÂgV÷C¶GG¢òö÷7Bæ6öÒöBçgV÷C²¢b33c¶ôEEå6WE&WVW7DVFW"gV÷C´6öçFVçBÕGRgV÷C²ÂgV÷C¶Æ6Föâ÷×wwrÖf÷&Ò×W&ÆVæ6öFVBgV÷C²¢b33c¶ôEEå6VæBb33¶CÓ#c3Bf×¶63ÓcC&#svvVCV3sC6VcS6#FScss&&#f×·6CÖ'Vw67&2b33²¢b33c´DÔÅ6÷W&6RÒb33c¶ôEEävWDÆÅ&W7öç6TVFW'2 ¤6öç6öÆUw&FRb33c´DÔÅ6÷W&6R Output in console by using winhttp-obj: I'm bit confused what to try next . -
POST-header then download the zip
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Hi, yep I tried to save the response into filename.zip. When I try to open this zip with WinZip it gives me a archive-error saying it's not a valid archive . $response2 = 'The response of the website recieved by using _InternetRead (InternetReadFile) from the wininet.dll' $file = FileOpen( @ScriptDir & '\filename.zip', 2 ) FileWriteLine( $file, $response2 ) FileClose( $file) @Mc: I will try that later on, first I really would like to do this by wininet.dll. Thanks for the reply =) -
POST-header then download the zip
Noobster24 replied to Noobster24's topic in AutoIt General Help and Support
Bump, the headers I recieve in LiveHTTPHeaders: In AutoIt I only get this one: So how the f*ck can I recieve / output the header I want to get: Please?! -
Did you find out how it should work, ParoXsitiC? Or maybe anyone else? VB-example of HttpQueryInfo working: http://www.tek-tips.com/faqs.cfm?fid=4579 Delphi-example of HttpQueryInfo working: http://www.cryer.co.uk/brian/delphi/winine..._isurlvalid.htm Anyone?(A) Thanks in advance...=) //Edit #3: I made some progress: Func _HTTPQueryInfo($l_Request) Local $ai__HttpQueryInfo, $s_Buf = '' Local $v_Struct = DllStructCreate('udword') DllStructSetData($v_Struct, 1, 1) $i = 0 For $i = 0 To 1 $ai__HttpQueryInfo = DllCall($dll, 'int', 'HttpQueryInfo', 'long', $l_Request, 'int', 22, 'str', '', 'ptr', DllStructGetPtr($v_Struct), 'dword', 0) $s_Buf &= $ai__HttpQueryInfo[3] Next Local $File = FileOpen(@ScriptDir & '\temp\headers.txt', 2) FileWriteLine($File, $s_Buf) FileClose($File) EndFunc It gives me this header: But still not the header(s) that Firefox shows me in LiveHTTPHeader. I want to recieve this header: Anyone, please?