Sign in to follow this  
Followers 0
big_daddy

Using WinHTTP to POST and Receive File

3 posts in this topic

I was working on a solution for adamchapman on his topic here. I was able to make the option change quite easily, but downloading the file is a different story.

AutoIt Code to change select option

#include <IE.au3>

$sSymbol = "AA"
$sURL = "http://www.nasdaq.com/symbol/" & $sSymbol & "/historical"
$sFormId = "getFile"
$sSelectId = "ddlTimeFrame"
$sOptionValue = "5d"
$sInputId = "quotes_content_left_submitString"
$sLinkText = "Download this file in Excel Format"
$bDownload = False

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)
$oSelect = _IEGetObjById($oIE, $sSelectId)
_IEFormElementOptionSelect($oSelect, $sOptionValue)
If $bDownload Then _IELinkClickByText($oIE, $sLinkText)

I reviewed the function tied to the change event. This same function is called when you click the download link. The only difference is the argument is false and true respectively. I removed the code that is executed when false as it is not relevant for the issue. It basically builds a string with the selected option value + true + symbol (Example: 5d|true|AA), then sets the value of the input that has an id ending in submitString and submits the form.

function getQuotes(download) 
        {
            if(!download)
                showLoadingSpinner();
            
            var data = $("[id$='ddlTimeFrame']").val();
            var submitString = data + '|' + download + "|" + quoteBoxSelectedSymbol;
            
            if (!download) {
                <!-- Removed -->
            }
            else {
                $("[id$='submitString']").val(submitString);
                $("#getFile").submit();
            }
            
        }

-


Now we move on to the form that is submitted by the getQuotes function. The input with id "quotes_content_left_submitString" is the input that will have the value set from the previous function. 

<form id="getFile" method="post" action="http://www.nasdaq.com/symbol/aa/historical" lpsubdone="1">
    <div class="aspNetHidden">
        <input id="__VIEWSTATE" name="__VIEWSTATE" value="TRIMMED" type="hidden">
    </div>

    <div class="aspNetHidden">
        <input id="__VIEWSTATEENCRYPTED" name="__VIEWSTATEENCRYPTED" value="" type="hidden">
        <input id="__EVENTVALIDATION" name="__EVENTVALIDATION" value="FslL5mK8EfHMdRmVPirjPRHx0rzoR4ZblfHZcyVf/H6sJ58PbPdR2nXwJige52KEPcse4Wp37klD+PDrLXkhysNoAbltd+CEe5ntj67kFmk=" type="hidden">
    </div>
    <input id="quotes_content_left_submitString" name="ctl00$quotes_content_left$submitString" value="" type="hidden">
</form>

-


I believe this can be easily solved using WinHTTP, however I don't have a good understanding of that library currently. I did use Fiddler to capture the request and response that are generated when downloading the file.

Request

POST /symbol/aa/historical HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
X-SFS-Content-Type: text/html; charset=utf-8
X-SFS-Top: http://www.nasdaq.com/symbol/aa/historical
Referer: http://www.nasdaq.com/symbol/aa/historical
Accept-Language: en-US
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: www.nasdaq.com
Content-Length: 5687
Connection: Keep-Alive
Pragma: no-cache
Cookie: c_enabled$=true; clientPrefs=||||black; asi_segs=C10001|C10003|C10023|C0; s_pers=%20bc%3D1%7C1372648582375%3B%20s_nr%3D1372562217412-New%7C1380338217412%3B; userSymbolList=AA+; userCookiePref=true; s_sess=%20s_cc%3Dtrue%3B%20s_sq%3Dnasdaqprod%253D%252526pid%25253D%25252528AA%25252529%25252520Historical%25252520Prices%25252520%25252526%25252520Data%25252520-%25252520NASDAQ.com%252526pidt%25253D1%252526oid%25253Djavascript%2525253AgetQuotes%25252528true%25252529%2525253B%252526ot%25253DA%252526oi%25253D898%3B; NSC_W.TJUFEFGFOEFS.OBTEBR.80=ffffffffc3a08e3745525d5f4f58455e445a4a423660; __atuvc=5%7C26

__VIEWSTATE=vrdXsfBP2CJNWK4qdpzeDQ%2B85IYYgny7JkJYNc%2F3LaENWzOHiJW05WwMwTsOS7lz3jxV2h%2FQWE0JiUa2EbHDcTMVVTPixtTnlCXdTmZJglCj8ENYrGrMRlQJ3ZiX7Bp2%2Fgos2pw6fVLkRKq5QwDuqfzPd9N7T%2FqqIkg0pMJWXi6XFLwU8hgmOMiK7TCpvWg0tlE9Qk0Syk26AlbkmAcTb4Js%2FcE2G1L0j%2FrnbficD2aJCYrLVtUp5zkns7Q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ctrue%7CAA

Response

HTTP/1.0 200 OK
Content-Type: application/octet-stream; charset=utf-8
Content-Disposition: attachment; filename=HistoricalQuotes.csv
X-Powered-By: ASP.NET
Content-Length: 377
Expires: Sun, 30 Jun 2013 03:17:04 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Sun, 30 Jun 2013 03:17:04 GMT
Set-Cookie: NSC_W.TJUFEFGFOEFS.OBTEBR.80=ffffffffc3a08e3745525d5f4f58455e445a4a423660;expires=Sun, 30-Jun-2013 03:27:04 GMT;path=/;httponly
X-Cache: MISS from NORRX0200Bay11
X-Cache-Lookup: MISS from NORRX0200Bay11:10088
Via: 1.0 NORRX0200Bay11 (squid/3.1.14)
Connection: close

"date","close","volume","open","high","low"

"2013/06/28","7.8200","14525620.0000","7.8300","7.8800","7.7800"
"2013/06/27","7.8700","13891800.0000","7.8000","7.8700","7.7600"
"2013/06/26","7.7500","23732700.0000","7.9600","7.9600","7.7200"
"2013/06/25","7.9200","16871440.0000","7.8700","7.9300","7.8300"
"2013/06/24","7.7900","29888500.0000","7.9600","7.9700","7.7050"

-


I'd like to get the csv file downloaded using WinHTTP, but the main purpose of this is to learn how to use WinHTTP.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

So that getQuotes() sets form field automatically based on symbol and time period for which you want the data for. This works fine for me:

#include "Winhttp.au3"


Local $sOut = DownloadThatThing("AA", "5d")

ConsoleWrite("!ERROR = " & @error & @CRLF)
ConsoleWrite("+>$sOut : " & @CRLF & $sOut & @CRLF & @CRLF)
;~ MsgBox(4096, "Response", StringFormat($sOut))


Func DownloadThatThing($sSymbol, $sTimePeriod = "3m")

    ; Initialize and get session handle
    Local $hOpen = _WinHttpOpen()
    ; Get connection handle
    Local $hConnect = _WinHttpConnect($hOpen, "www.nasdaq.com")

    ; Fill the form (id of the form is -getFile-)
    Local $sHTML = _WinHttpSimpleFormFill($hConnect, "symbol/" & $sSymbol & "/historical", "getFile", _
            "quotes_content_left_submitString", $sTimePeriod & "|true|" & $sSymbol) ; <- filling only this (thre rest is left default)

    Local $iErr = @error ; collect error

    ; Close handles
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    ; Return whatever the result
    Return SetError($iErr, 0, $sHTML)
EndFunc
Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

That was less complicated than I thought. Thank you for the help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • nhardel
      By nhardel
      I have been working on trying to develop some scripts to interface with the REST/JSON API from the Orion SDK.  This is where I will ask my questions and hopefully get some community responses that could help benefit others. 
      https://github.com/solarwinds/OrionSDK
      I am trying to create examples of how to interface with the API from autoit.  This should be a knowledge dump for this task. 
    • n3wbie
      By n3wbie
      How to send Requests on https Website
      I tried using
      ObjCreate("winhttp.winhttprequest.5.1")
      But m not Receiving Any response
      m able to retrive https://google.com but same is not available on other site( https://gst.gov.in )
      kindly help me
    • nhardel
      By nhardel
      So I have been bashing my head in for a couple days and have searched both AutoIT forums and Thwack Forums for an answer.  I understand this could be hard to help sense I can't provide a server for someone to help me test against.  I am trying to use the WinHTTP.au3 to connect with Solarwinds Orion SDK thru REST/JSON api calls.  Here is the documentation that they provide.
      https://github.com/solarwinds/OrionSDK/wiki/REST
      I have been trying just to make a basic connection but for some reason cannot get past the authorization process with WinHTTP.  Here is my test code.
      #Region Includes #include <log4a.au3> #include "WinHttp.au3" #EndRegion Global $sAddress = "https://usandl0213:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID+FROM+Orion.NODES" Global $array_URL = _WinHttpCrackUrl($sAddress) ;~ Row|Col 0 ;~ [0]|https ;~ [1]|2 ;~ [2]|usandl0213 ;~ [3]|17778 ;~ [4]| ;~ [5]| ;~ [6]|/SolarWinds/InformationService/v3/Json/Query ;~ [7]|?query=SELECT+NodeID+FROM+Orion.NODES Global $hOpen = _winhttpOpen() If @error Then _log4a_Fatal("Error intializing the usage of WinHTTP functions") Exit 1 EndIf Global $hConnect = _winhttpConnect($hOpen, $array_URL[2]) If @error Then _log4a_Fatal("Error specifying the initial target server of an HTTP request.") _WinHttpCloseHandle($hOpen) Exit 2 EndIf Global $hRequest = _WinHttpOpenRequest($hConnect, _ "GET", _ "/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID+FROM+Orion.NODES", _ "HTTP/1.1") If @error Then _log4a_Fatal(MsgBox(48, "Error", "Error creating an HTTP request handle.") _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Exit 3 EndIf _WinHttpAddRequestHeaders($hRequest, "Authorization: Basic YXV0b2l0X2xvZ2luOnRlc3Q=") _WinHttpAddRequestHeaders($hRequest, "User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3") _WinHttpAddRequestHeaders($hRequest, "Host: usandl0213:17778") _WinHttpAddRequestHeaders($hRequest, "Accept: */*") _WinHttpSendRequest($hRequest) If @error Then MsgBox(48, "Error", "Error sending specified request.") Close_request() Exit 4 EndIf ; Wait for the response _WinHttpReceiveResponse($hRequest) If @error Then MsgBox(48, "Error", "Error waiting for the response from the server.") Close_request() Exit 5 EndIf Global $sChunk, $sData ; See what's returned If _WinHttpQueryDataAvailable($hRequest) Then Global $sHeader = _WinHttpQueryHeaders($hRequest) ;~ ConsoleWrite(@crlf) ConsoleWrite($sHeader & @CRLF) ; Read While 1 $sChunk = _WinHttpReadData($hRequest) If @error Then ExitLoop $sData &= $sChunk WEnd ConsoleWrite($sData & @CRLF) ; print to console Else MsgBox(48, "Error", "Site is experiencing problems.") EndIf Close_request() Func Close_request() ; Close open handles and exit _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) EndFunc I am definitely connecting to the server but get a 401 Unauthorized response.  Output of above script:
      Header:
      HTTP/1.1 401 Unauthorized Cache-Control: private Date: Thu, 27 Jul 2017 15:31:21 GMT Content-Length: 1668 Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 Set-Cookie: ASP.NET_SessionId=lgwin2qsbbrip2mxg01fot05; path=/; HttpOnly Set-Cookie: TestCookieSupport=Supported; path=/ Set-Cookie: Orion_IsSessionExp=TRUE; expires=Thu, 27-Jul-2017 17:31:21 GMT; path=/ WWW-Authenticate: Negotiate WWW-Authenticate: NTLM X-UA-Compatible: IE=9 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-Same-Domain: 1 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Body:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><link rel="stylesheet" type="text/css" href="/orion/js/jquery-1.7.1/jquery-ui.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <link rel="stylesheet" type="text/css" href="/orion/styles/orionminreqs.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <link rel="stylesheet" type="text/css" href="/webengine/resources/steelblue.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <link rel="stylesheet" type="text/css" href="/orion/ipam/res/css/sw-events.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <script type="text/javascript" src="/orion/js/orionminreqs.js.i18n.ashx?l=en-US&v=42660.90.L"></script> <script type="text/javascript" src="/orion/js/modernizr/modernizr-2.5.3.js.i18n.ashx?l=en-US&v=42660.90.L"></script> <script type="text/javascript" src="/orion/js/jquery-1.7.1/jquery-1.7.1.framework.min.js.i18n.ashx?l=en-US&v=42660.90.L"></script> <script type="text/javascript">(function(){var de=$(document.documentElement); de.addClass('sw-is-locale-en'); $.each(jQuery.browser,function(k,v){if(v===true){ de.addClass('sw-is-'+k); de.addClass('sw-is-'+k+'-'+parseInt(jQuery.browser.version)); }}); })();</script> <script type="text/javascript">SW.Core.Loader._cbLoaded('jquery');</script> <script type="text/javascript">SW.Core.Date._init(0,-14400000);</script> <title> </title></head> <body> <script> window.location = 'Login.aspx'; </script> </body> </html> To me this looks like it if it is still looking for my credentials.   I did verify that things work as expected using Chrome and REST test client.  I do get certificate errors in IE if I try to go directly.  Bypass certificate issues and page will try to save out to .json file
       
      Looking for any help.
    • 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 = "https://www.sportinglife.com/racing/results"
      $oHTTP.Open("GET", $url, False)
      $oHTTP.setRequestHeader ("User-Agent", $agent)
      $oHTTP.Option(4) = 13056
      $oHTTP.Send()
      $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.