Search the Community
Showing results for tags 'request'.
-
Im making requests to REST API WORDPRESS is it right code ? $metabox = 'meta_box={"uuid":" ' & urlEncode($MY_ID) & ' "}' _httpRequest("https://MYSITE/wp-json/wp/v2/users/" & $id &"?", "POST", $metabox,$success) In postman im making request like this and its working. it should be the same in autoit https://MYSITE/wp-json/wp/v2/users/8?meta_box={"uuid": "2342342342"}
-
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
-
Hello Opertation Sys: Win7 x64 Problem: Connecting to webs using TLS 1.1 + Description: WinHttp.WinHttpRequest.5.1 using TLS 1.0 by default, i need higher version to connect into some webs. Dim $oHttp = ObjCreate("WinHTTP.WinHTTPRequest.5.1") $oHttp.open ("GET", "https://howsmyssl.com/a/check", False) $oHttp.Option(9) = 128 ; 128 - TLS 1.0, 512 - TLS 1.1, 2048 - TLS 1.2, 2056 - TLS 1.1 & TLS 1.2 $oHttp.Send ConsoleWrite($oHttp.responseText & @CRLF) ; at end of the respond you can check your TLS version. Mine is: {"tls_version":"TLS 1.0","rating":"Bad"} Error: $oHttp.Option works only with parameter 128 (TLS 1.0) other values make error {Bad parameter} Additional: I've done this tutorial about enabling TLS in registry: <link> Thanks for support. Ascer
-
Like Request for node.js or Requests for python, Request UDF is a powerful and easy-to-use HTTP client for AutoIt. It is based on my Curl.au3 and Json.au3 (not included). The Features: Request target can be a string (single url), an array (urls), an object (single url + options or url array + options), an object array (urls + different options), or a json string (decode to array or object automatically), etc.Easy to setup post data, cookies, agent, refer, timeout, proxy, etc.Easy to setup the default options before a series of requests.Use BinaryToString() to decode the returned data according to content type automatically. Use curl multi interface by default. It means all requests will transfer simultaneously and won't block the GUI event.Use callback function to recieve the data and information for every url before main function finished.Supports https and ftp protocols.Example: #Include "Json.au3" #Include "Curl.au3" #Include "Request.au3" RequestDefault('{refer: "http://www.autoitscript.com", agent: "AutoIt/Request", callback: "MyCallback"}') Local $Data = Request("http://httpbin.org/get") ConsoleWrite($Data & @LF) Request('["http://www.google.com", "http://wikipedia.org"]') Request('{url: "http://www.google.com", agent: "AutoIt/Request"}') Request('{url: ["http://www.google.com", "http://wikipedia.org"], agent: "AutoIt/Request"}') Local $Array[] = ["http://www.google.com", "http://wikipedia.org"] Request($Array) Request("http://httpbin.org/post", "key=Post%20can%20be%20the%20raw%20data") Request("http://httpbin.org/post", '{key: "Post can be a json object string"}') Request('{url: "http://httpbin.org/post", post:{key: "Post can be set as second paramemtr or \"post\" option"}}') Local $Obj Json_Put($Obj, ".key", "Post can be an object") Local $Json = Request("http://httpbin.org/post", $Obj) Func MyCallback($Obj) Local $Data = Json_ObjGet($Obj, "Data") Local $EffectiveUrl = Json_ObjGet($Obj, "EffectiveUrl") ConsoleWrite("Callback: " & $EffectiveUrl & " download size: " & StringLen($Data) & @LF) EndFunc More examples are in the archive. Request.zip
-
-
Hello, I try to monitor my website with autoit sending get and post requests. It works super fine on my computer but once i migrate the script on my server, http request dont work anymore. My errfunc handler returns error 80072f05 which means, google says : My clock is fine, whatsup with this ssl certificate thing ? My website is not https. Thanks in advance, JB
-
HttpHeaderWatcher v1.0.1.3 Some time ago, some members asked how to see the Http Requests. There are quite a few external applications but not in AutoIt! HttpHeaderWatcher in association with WinPcap, very modestly solves this lack. Once done this http watcher, i asked me : why not Re-build a WinHttp Request in AutoIt from a selected Request in one Click ? So i have added a "Create au3" button who open the WinHttp Request of your choice in AutoIt format in SciTE Editor. Voila voila, hope it can help ! Buttons were made online with chimply.com the easy and free buttons generator ! See Help for more infos. previous downloads : 253 source and executable are available in the Download Section Hope you like it !
-
I would like to programmatically check to see if a given tracker has information on the torrent I specify. This requires that the SHA-1 Info Hash of a torrent be encoded to make valid requests. I read from: http://nakkaya.com/2009/12/03/bittorrent-tracker-protocol/ If you don't pay attention to the spec and send this directly to tracker you will get an error this should be in URL Encoded form. Padding every two chars with % sign also doesn't work, been there done that don't waste your time. Any hex in the hash that corresponds to a unreserved character should be replaced, a-z A-Z 0-9 -_.~ Partition the hex in to chunks of two and check if the hex corresponds to any of these values, if they do replace them with the unreserved char. So that a hash such as, 123456789abcdef123456789abcdef123456789a becomes, %124Vx%9a%bc%de%f1%23Eg%89%ab%cd%ef%124Vx%9a notice that hex 34 became 4 which is what it is in ASCII. You can test the correctness of your hashes using the tracker url but don't request from announce request from file, http://some.tracker.com/file?info_hash=hash If you get a torrent back that means you have the correct hash. I have tried the above and failed. Here's my code: $testStr = "123456789abcdef123456789abcdef123456789a" ConsoleWrite(_EncodeHash($testStr) & @CRLF) Func _EncodeHash($sString) If (Not IsString($sString)) Or $sString = "" Then Return SetError(1, 0, 0) Local $aArray = StringRegExp($sString, "(?s).{1," & 2 & "}", 3), $sEncodedHash For $i = 0 To UBound($aArray) -1 If StringInStr($sString, Chr(Dec($aArray[$i]))) Then $sEncodedHash &= Chr(Dec($aArray[$i])) Else $sEncodedHash &= "%" & $aArray[$i] EndIf Next Return $sEncodedHash EndFuncIf you follow the first link in my post there is an example but I'm unfamiliar with the language being used. Thanks for any help.