Search the Community
Showing results for tags 'WinHttpRequest'.
-
Hello , I am trying to use Websockets in AutoIt. It is to fetch live stock market prices , API is provided and documentation available for python language. The link for the code snippet is : https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Introduction https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Instruments/paths/~1instruments~1subscription/post https://github.com/symphonyfintech/xts-pythonclient-api-sdk Second Link is to subscribe to a list of ExchangeInstruments. Now I would like to get live stock ltp (LastTradedPrice) for a few stocks whose "ExchangeInstrumentID" I know. I am able to use the WinHttp object to perform actions using simple codes like below : I have the secretKey and appkey and can generate the needed token. And get the unique ExchangeInstrumentID. Below code is just for example of how I am using WinHttp. Unrelated to socket part. Global $InteractiveAPItoken = IniRead(@ScriptDir & "\Config.ini", "token", "InteractiveAPItoken", "NA") $baseurl = "https://brokerlink.com/interactive/" $functionurl = "orders" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $baseurl & $functionurl, False) $oHTTP.SetRequestHeader("Content-Type", "application/json;charset=UTF-8") $oHTTP.SetRequestHeader("authorization", $InteractiveAPItoken) $pD = '{ "exchangeSegment": "NSEFO", "exchangeInstrumentID": ' & $exchangeInstrumentID & ', "productType": "' & $producttype & '", "orderType": "MARKET", "orderSide": "' & $orderside & '", "timeInForce": "DAY", "disclosedQuantity": 0, "orderQuantity": ' & $qty & ', "limitPrice": 0, "stopPrice": 0, "orderUniqueIdentifier": "' & $orderidentifier & '"}' $oHTTP.Send($pD) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status But am struggling to understand and use socket. Would be of great help if you can have a look at the link mentioned above and help with the code sample for AutoIt. To connect and listen to a socket. Thanks a lot
- 2 replies
-
- websockets
- winhttprequest
-
(and 2 more)
Tagged with:
-
Hello , A website I am trying to login with my credentials. And retrieve the cookie into a text file. Unable to do so. Is it that certain, Httponly , type - are not allowed to be fetched. Then further , I will be checking every 5 minutes if my session is active , else re-login and re-fetch the cookie. For the second part , I will probably fetch some table and see if not in appropriate format do Part 1 : Fetch Cookie - again. Any better way , tips would be appreciated. Thanks
-
Greetings, I want use WinHttpRequest to access a OpenShift API server, it use a self signed certificate. Does now work... I never try with a self signed certificate, how do this? Best regards Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://openshift.domain:1234/api/", False) $oHttp.Option(4) = 0x0100 + 0x0200 + 0x1000 + 0x2000 $oHTTP.Option(9) = 0x0080 ;WinHttpRequestOption_SecureProtocols ;~ $oHttp.SetClientCertificate("LOCAL_MACHINE\\Personal\\certificado.crt") $oHttp.Send() $oHttp.WaitForResponse() Local $oAllHeaders = $oHttp.GetAllResponseHeaders() $oReceived = $oHttp.ResponseText $oStatusCode = $oHttp.Status $oHttp = 0 If $oStatusCode = 200 Then ConsoleWrite("$oAllHeaders--------------------" & @LF & $oAllHeaders & "$oAllHeaders--------------------" & @LF) Else ConsoleWrite("< error = " & $oReceived & @LF & $oAllHeaders & @LF) EndIf
- 1 reply
-
- winhttprequest
- certificate
-
(and 2 more)
Tagged with:
-
Hi Guys, I am having an issue with multiple Windows 10 systems (actually all systems running Windows 10 running the same script have this issue) I have a script which calls the winhttp.winhttprequest.5.1 object and allows me to get sites HTML source, I am using multiple Open commands on the same object which I didn't assume would be an issue. The issue I am getting is quite often the Send command to the object will fail (in fact I have not been able to finish running the script because it fails everytime) with an Error Now this exact code was working fine in Windows 8/8.1 and Windows 7 before I upgraded the systems to Windows 10, anybody know what's going on here? P.S when I say I use multiple Open and Send commands I mean I have two instances of winhttprequest objects open and it probably does a total of about 600 Open and Sends but as I mentioned this had never been an issue until Windows 10.
- 2 replies
-
- winhttp
- winhttprequest
-
(and 1 more)
Tagged with:
-
Hi, Just after updated Autoit to the latest version (the older version was around one year old), things like the following stopped working. $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://example.com/s.php", True) $sPD = "" $oHTTP.Send($sPD) MsgBox(4096, 'return', $oHTTP.Status) Exit It doesn't give any errors, it just doesn't return anything. Any help?
-
Not familiar with "winhttp.winhttprequest.5.1" Object, Ergo: Just experimenting a bit with it. When using the 'ResponseStream' option ... AutoIt crashes. - Anything I'm doing wrong (or missed) ? (or potential issue/bug) Don't know much about a 'IStream', other than that 'ResponseStream' is supposed to return a pointer to it. msdn: WinHttpRequest Object main() Func main() Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") Local $sType = 'GET' Local $sUrl = 'http://www.autoitscript.com/site/' Local $sData = '' ;; optional parm. _HTTPRequest($oHTTP, $sType, $sUrl, $sData) EndFunc Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "") ;; http://msdn.microsoft.com/en-us/library/aa384106 Local $iResult = 0 ;; debug $oHTTP.Open($oMethod, $oURL, False) ;; empty -> ok. $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5") ;; empty -> ok. If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ;; empty -> ok. EndIf $oHTTP.Send($oData) ;; empty -> ok. ;~ ;; options: ResponseBody, ResponseStream, ResponseText, Status, StatusText ;~ $iResult = $oHTTP.StatusText ;; "OK" -> ok. ;~ $iResult = $oHTTP.Status ;; 200 -> ok. ;~ $iResult = $oHTTP.ResponseBody ;; binary(ResponseText) -> ok. ;~ $iResult = $oHTTP.ResponseText ;; html page/content -> ok. $iResult = $oHTTP.ResponseStream ;; crash with 3.3.6.1 & 3.3.7.14 (Win.Xp.32b) EndFunc
- 1 reply
-
- ResponseStream
- WinHttpRequest
-
(and 1 more)
Tagged with: