Search the Community
Showing results for tags 'https'.
-
I can TCP/IP in AutoIt, hence, make a HTTP deamon. Now, how can I HTTPS to use SSL !?? Well, Apache has this "mod_proxy.so" module that can let me have SSL and what not is in Apache. All that is needed is to tell Apache what I wanna do by editing httpd.conf . # Implements a proxy/gateway for Apache. # 1. Open /Applications/XAMPP/etc/httpd.conf # 2. Enable the following Modules by removing the # at the front of the line. # - LoadModule rewrite_module modules/mod_rewrite.so # - LoadModule proxy_module modules/mod_proxy.so # - LoadModule proxy_http_module modules/mod_proxy_http.so # # 3. Copy and Paste below to the bottom of httpd.conf # <IfModule mod_proxy.c> ProxyRequests On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyVia Off ProxyPreserveHost Off ProxyPass /home/ http://127.0.0.1:84/home/ ProxyPassReverse /home/ http://127.0.0.1:84/home/ SetEnv proxy-nokeepalive 1 # ..since we are not using "keep-alive", we are using "close" </IfModule> ...et voila I'm using XAMPP ( https://www.apachefriends.org/download.html ) and this is my solution to avoid coding in PHP, as I feel more comfortable coding in AutoIt. A "muli-thread or concurrency" can be done by forking the socket ( https://www.autoitscript.com/forum/topic/199177-fork-udf-ish/ ) but responses are under 20 ms., so I feel fine with a single thread. I modified an example ( attached below ), so can try out the concept. PS: I am not an Apache guru. I just discovered this and it opens a world of possibilities. In my case, I'm thinking of an API to query SQLite PS2: I'm not gonna make Poll but do click like if you do 201673-json-http-post-serverlistener.au3
-
I built my own libcurl for AutoIt based on BinaryCall UDF. libcurl - the multiprotocol file transfer library The Features: Pure AutoIt script, no DLLs needed.Build with SSL/TLS and zlib support (without libidn, libiconv, libssh2).Full easy-interface and partial multi-interface support.Data can read from or write to autoit variables or files.Smaller code size (compare to most libcurl DLL).The version information of this build: Curl Version: libcurl/7.42.1SSL Version: mbedTLS/1.3.10Libz Version: 1.2.8Protocols: ftp,ftps,http,httpsHere are the helper functions (not include in libcurl library). Curl_DataWriteCallback()Curl_DataReadCallback()Curl_FileWriteCallback()Curl_FileReadCallback()Curl_Data_Put()Curl_Data_Get()Curl_Data_Cleanup()See the example script for detail usage. Curl.zip
-
A little help here please !? I'm trying to parse a file but the function is not working well! i think there is some thind doing wrong at FileRead() Obs: username,password and API link below is fictitious ConsoleWrite(">POST METHOD UPLOADING LOCAL IMAGE<" & @CRLF) _PostMethodTest() Func _PostMethodTest() Local Const $sAPIKey = '8f1e0a750088957' Local $sBoundary = "--------Boundary" Local $sHeaders = "Content-Type: multipart/form-data; boundary=" & $sBoundary & @CRLF Local $sData = '' Local $sFileName="image.jpg" Local $sFilePath="C:\Users\DELL\Desktop\" & $sFileName Local $hFile=FileOpen($sFilePath,16);16=$FO_BINARY Local $sFileData=FileRead($hFile) FileClose($hFile) $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="myImage"; filename="' & $sFileName & '"' & @CRLF $sData &= 'Content-Type: application/upload' & @CRLF & @CRLF $sData &= BinaryToString($sFileData,0) & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="username"' & @CRLF & @CRLF $sData &="myuserName" & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="password"' & @CRLF & @CRLF $sData &="MyPassword" & @CRLF $sData &=$sBoundary & "--" ConsoleWrite($sData) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myapi", False) $oHTTP.SetRequestHeader("Content-Type", "multipart/form-data; " & "boundary=" & $sBoundary) $oHTTP.SetRequestHeader("apikey", $sAPIKey) $oHTTP.Send(StringToBinary($sData,1)) Local $sReceived = $oHTTP.ResponseText ConsoleWrite($sReceived & @CRLF) EndFunc ;==>_PostMethodTest
-
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 need help. I have searched the forum before posting and i couldn't find anything. The code below works fine when downloading files from "http" sites, but when trying to download from "https" sites, no files are downloaded. I tried different sites and I experience the same problem everywhere. Is there something I'm missing or doing wrong? Please note that I'm not a programmer and I'm new to this. I'm just using logic wherever i can to get things done. your help will be highly appreciated. #include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ; Download a file in the background. ; Wait for the download to complete. Example() Func Example() ; Save the downloaded file to the temporary folder. Local $sFilePath = "d:\" ; Download the file in the background with the selected option of 'force a reload from the remote site.' Local $hDownload = InetGet("https://en.wikipedia.org/wiki/HTTPS#/media/File:Internet2.jpg", $sFilePath& "Internet2.jpg", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath&"Internet2.jpg") ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _ "The total filesize: " & $iFileSize) ; Delete the file. ;FileDelete($sFilePath) EndFunc ;==>Example
-
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.
-
You may have already seen the NetSession UDF thread. The code is really helpful for IE controls and there's no other known way to accomplish what it does. There are a few things that should be improved. The most important being able to pass proxy authentication to a proxy server using urlmon.dll or maybe some other windows API method alltogether. Here's our thread: '?do=embed' frameborder='0' data-embedContent>> Give it a read and be sure to check out the attempt to improve by SmOke_N: page-2#entry1220599'>page-2#entry1220599 Currently, since we have to pass proxy authentication via the URL, if the proxy requires authentication we can't access HTTPS sites with it (Apparently when using HTTPS you aren't allowed to pass auth in the URL). That's why we want to pass the auth through the DLL or any other method that will work with our embedded browser on a per-process basis. Thank you to anyone who can help make this UDF better.
- 3 replies
-
- netsession
- udf
-
(and 7 more)
Tagged with:
-
So lets say I have the link : "autoitscript.com/forum/" How can I find if its HTTP or HTTPS secured or maybe other protocol ? I would prefer via the _IE UDFs if possible... Thanks in advance !