Sign in to follow this  
Followers 0

WinHTTPSimpleRequest keep connection alive

1 post in this topic

This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Similar Content

    • Jefrey
      By Jefrey
      I've ported these two functions from PHP to AU3 to work with URLs.
      Made them for those who work with libraries like HTTP.au3 (not the one I coded), that needs passing the server domain, path, etc., instead of the full URL.
      Grab the lib here.
      ParseURL( $sURL )
      Parses the URL and splits it into defined parts. Returns an array:
      [0] = Full URL (same as $sURL) [1] = Protocol (i.e.: http, https, ftp, ws...) [2] = Domain [3] = Port (or null if not specified) [4] = Path (or null if not specified) [5] = Query string (everything after the ? - or null if not specified) Example:
      $aExample = ParseURL("") MsgBox(0, "Test", "URL: " & $aExample[0] & @CRLF & _ "Protocol: " & $aExample[1] & @CRLF & _ "Domain: " & $aExample[2] & @CRLF & _ "Port: " & $aExample[3] & @CRLF & _ "Path: " & $aExample[4] & @CRLF & _ "Query string: " & $aExample[5])  
      ParseStr( $sStr )
      Parses a query string (similar to the [5] of the previous function) and returns a multidimensional array, where:
      [0][0] = number of variables found [0][1] = ununsed [1][0] = key name of the first variable [1][1] = first variable value (already URL decoded) [n][0] = key name of the nth variable [n][1] = nth variable value (already URL decoded) Example:
      include <Array.au3> ; need only to do _ArrayDisplay, not needed by the lib _ArrayDisplay(ParseStr("foo=bar&test=lol%20123")) #cs Result is: [0][0] = 2 [0][1] = ununsed [1][0] = foo [1][1] = bar [2][0] = test [2][1] = lol 123 #ce Feel free to fork!
    • mjolnirmarkiv
      By mjolnirmarkiv
      I have a potential problem of memory leakage in the script I wrote and wonder if anyone will be able to suggest a potential source of the problem?
      The script is desgined to log into secure website and constantly send HTTP GET request to obtain a list of tasks the client has assigned to us (the tasks are auctions, so swift actions are neccessary, hence the script) and then occasionally send HTTP POST to accept certain tasks based on certain criteria. It works 24/7 and works alright, but I noticed that amount of RAM it uses will increase significantly over time (say, it jumps from 20 000 K to 100 000 K in a few days).
      I cannot post the entire script: it modestly big, also might contatin some sensetive information. But here's the main loop (like, exactly):
      While True If Script_SignIn() And Script_GetTasks() Then Script_AcceptTasks() Sleep(10) WEnd The Script_ functions are here just to simplify the structure, they don't pass any parameters to each other, just return True \ False when finished and change some global variables when executed. Entire GUI is in OnEvent mode.
      TMS_ functions are where the actual work is done, names are self-explanatory:
      TMS_SignIn($sURL, $sUsername, $sPassword) -- returns $sAuthKeys (used subsequently in other functions to authenticate yourself, while session is active). TMS_GetTasks(ByRef $oHTTP, $sURL, $sAuthKeys) -- this function is running constantly returning $avTasks (basically a table with all information I need to accept them), I'm passing a global variable $g_oHTTP to it, it creates HTTP object only once per session (hence ByRef, I don't want to locally create HTTP object at every pass, just create once and reuse) and in next loop I pass the object the function created to it again, $g_oHTTP is destroyed when session has ended and recreated in next loop after re-login. TMS_AcceptTasks(ByRef $avTasks, $sURL, $sAuthKeys) -- returns True\False (changes $avTasks table slightly -- the status of acceptance if it's successful). TMS_SignOut($sURL, $sAuthKeys) -- returns True\False. These functions create local HTTP and HTML objects inside as well, I even "= 0" them at the end, even though I don't think I need to do this, since they are local variables. Still the problem persists.
      Any ideas where to look?
    • RyukShini
      By RyukShini
      Hello everyone.
      I would like to automate some things on my forum with AutoIT and so far I successfully logged in and everything seems to be going well, however this type of form I have no clue on how to make, I tried with a couple of different ideas and what not, but so far it wont work.
      I already found what I need for making unix timestamps and so on, so all I need is to understand how to make this in WINHTTP
      $sRead = _WinHttpSimpleFormFill($xConnect, "posting.php?mode=post&f=124", Default, "name:topic_seo_title", "testing my stuff before actually posting", "name:seo_desc", "testing my stuff before actually posting", "name:icon", "2", "name:subject", "testing my stuff before actually posting", "name:addbbcode20", "100", "name:message", "MoonBoys full video rips from popular porn sites", "name:post", "Submit", "name:fileupload", "Content-Type: application/octet-stream", "name:filecomment", "name:lastclick", $iUnixTime, "name:creation_time", $iUnixTime, "name:form_token", $uh) ------WebKitFormBoundaryPH Content-Disposition: form-data; name="topic_seo_title" testing my stuff ------WebKitFormBoundaryPH Content-Disposition: form-data; name="seo_desc" testing my stuff ------WebKitFormBoundaryPH Content-Disposition: form-data; name="seo_key" ------WebKitFormBoundaryPH Content-Disposition: form-data; name="icon" 2 ------WebKitFormBoundaryPH Content-Disposition: form-data; name="subject" testing my stuff ------WebKitFormBoundaryPH Content-Disposition: form-data; name="addbbcode20" 100 ------WebKitFormBoundaryPH Content-Disposition: form-data; name="message" [center][b]testing this[/b] [i][b]test: test: [neon=Pink]Screenshots:[/neon] test Details:[/b][/i][/center] ------WebKitFormBoundaryPH Content-Disposition: form-data; name="post" Submit ------WebKitFormBoundaryPH Content-Disposition: form-data; name="fileupload"; filename="" Content-Type: application/octet-stream ------WebKitFormBoundaryPH Content-Disposition: form-data; name="filecomment" ------WebKitFormBoundaryPH Content-Disposition: form-data; name="lastclick" 1488467908 ------WebKitFormBoundaryPH Content-Disposition: form-data; name="creation_time" 1488467908 ------WebKitFormBoundaryPH Content-Disposition: form-data; name="form_token" 4ee1f6e9f21d7147f31a94d16bb16eaddf7bb3e8 ------WebKitFormBoundaryPHhcKRBLEwtQXIqY--  
    • luckyluke
      By luckyluke
      Hello all,
      Im trying to get the information from https website, but it does not return any thing, here is the code:
      Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
      $agent ='Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36'
      $url = ""
      $oHTTP.Open("GET", $url, False)
      $oHTTP.setRequestHeader ("User-Agent", $agent)
      $oHTTP.Option(4) = 13056
      $src = ($oHTTP.ResponseText)
      ConsoleWrite($url & @CRLF)
      MsgBox(0, '$src', $src)
      when i tried with other website, it is working, but this code does not works with this website. Pls help me
      thank you.
    • thang0408
      By thang0408
      Hi there,
      I'm trying to send a simple get request by ObjCreate("winhttp.winhttprequest.5.1")
      But it can only work on some computer, and it can't send request on other computer.
      I guess the problem is some computer have the different version of winhttp request (not 5.1, higher or lower)
      Can I send a get request without using winhttp?
      Thanks for your help!